@wavy/fn 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.cjs +1102 -0
- package/dist/main.d.cts +177 -0
- package/dist/main.d.ts +177 -0
- package/dist/main.js +1006 -0
- package/package.json +29 -0
- package/prepend.js +13 -0
package/dist/main.d.cts
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import "@wavy/types"
|
|
2
|
+
type DateFormat = "MMM dd, yyyy" | "MMM dd, yyyy | HH:mm A" | "MMM dd, yyyy at HH:mm A" | "MMMM" | "yyyy" | "MMM yyyy" | "mm/dd/yyyy" | "mm/dd/yyyy HH:mm A" | "HH:mm A";
|
|
3
|
+
|
|
4
|
+
type NumberFormatterTypes = {
|
|
5
|
+
formats: "money";
|
|
6
|
+
options: {
|
|
7
|
+
money?: {
|
|
8
|
+
showSigns?: boolean;
|
|
9
|
+
truncate?: boolean;
|
|
10
|
+
excludeDollarSign?: boolean;
|
|
11
|
+
dropDecimals?: boolean;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
declare class StringFormatter {
|
|
17
|
+
static vowels: string;
|
|
18
|
+
static caseConverter: {
|
|
19
|
+
camelToLetter: (camelCase: string) => string;
|
|
20
|
+
};
|
|
21
|
+
static extract: {
|
|
22
|
+
capitalLetters: (value: string, count?: number) => string[];
|
|
23
|
+
};
|
|
24
|
+
static trimString(value: string, trim: string): string;
|
|
25
|
+
static pluralize(value: string): string;
|
|
26
|
+
static addArticle(value: string, article: "a/an"): string;
|
|
27
|
+
static toSearch(from: string): string;
|
|
28
|
+
static toMoney(from: string, options?: NumberFormatterTypes["options"]["money"]): string;
|
|
29
|
+
static toTRN(from: string): string;
|
|
30
|
+
static toNumber(value: string): number;
|
|
31
|
+
static upperFirst(value: string): string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
declare const dateFormat: (time: number | Date | "now", format?: DateFormat) => string;
|
|
35
|
+
declare const timeDuration: (from: number, to: number, options?: {
|
|
36
|
+
disableRemainder?: boolean;
|
|
37
|
+
abvUnits?: boolean;
|
|
38
|
+
}) => string;
|
|
39
|
+
declare const upperFirst: typeof StringFormatter.upperFirst;
|
|
40
|
+
declare const camelCaseToLetter: (camelCase: string) => string;
|
|
41
|
+
declare const trimString: typeof StringFormatter.trimString;
|
|
42
|
+
declare const stringToSearch: typeof StringFormatter.toSearch;
|
|
43
|
+
declare const getCaps: (value: string, count?: number) => string[];
|
|
44
|
+
declare const toNumber: typeof StringFormatter.toNumber;
|
|
45
|
+
declare const addArticle: typeof StringFormatter.addArticle;
|
|
46
|
+
declare const pluralize: typeof StringFormatter.pluralize;
|
|
47
|
+
declare const nameToString: (name: Name | undefined) => string;
|
|
48
|
+
declare const phoneNoToString: (phoneNumber: PhoneNumber | undefined) => string;
|
|
49
|
+
declare const addressToString: (address: Address | undefined, inline?: boolean) => string;
|
|
50
|
+
declare const toMoney: (value: string | number, options?: NumberFormatterTypes["options"]["money"]) => string;
|
|
51
|
+
declare function format<Event extends "date" | "money" | "name" | "phone-number" | "address">(event: Event, ...args: Event extends "date" ? Parameters<typeof dateFormat> : Event extends "money" ? Parameters<typeof toMoney> : Event extends "name" ? Parameters<typeof nameToString> : Event extends "phone-number" ? Parameters<typeof phoneNoToString> : Event extends "address" ? Parameters<typeof addressToString> : never): Event extends "date" ? ReturnType<typeof dateFormat> : Event extends "money" ? ReturnType<typeof toMoney> : Event extends "name" ? ReturnType<typeof nameToString> : Event extends "phone-number" ? ReturnType<typeof phoneNoToString> : Event extends "address" ? ReturnType<typeof addressToString> : never;
|
|
52
|
+
declare function isFile(obj: unknown): obj is File;
|
|
53
|
+
declare function toObject<O extends File>(object: O, ...args: O extends File ? [
|
|
54
|
+
options?: Partial<{
|
|
55
|
+
uploadDate: number | "now";
|
|
56
|
+
description: string;
|
|
57
|
+
filepath: string;
|
|
58
|
+
filename: string;
|
|
59
|
+
typeAlias: LocalFile["typeAlias"];
|
|
60
|
+
}>
|
|
61
|
+
] : []): O extends File ? LocalFile | undefined : void;
|
|
62
|
+
declare function classNameResolver(baseClassName: string): (className: string) => string;
|
|
63
|
+
declare function classNameExt(rootClassName: string): (className: string) => string;
|
|
64
|
+
declare function range(start: number, end: number): number[];
|
|
65
|
+
declare function lastIndex(value: string | unknown[]): number;
|
|
66
|
+
declare function buildArray<T>(length: number, func: (idx: number) => T): T[];
|
|
67
|
+
declare function blankSpaces(count: number): string;
|
|
68
|
+
declare function ordinalIndicator(amount: number): string;
|
|
69
|
+
/**
|
|
70
|
+
*
|
|
71
|
+
*
|
|
72
|
+
* @param {Array<Object>} arr The array of generic objects to search
|
|
73
|
+
* @param {keyof Object} key The property to use when querying/finding an object
|
|
74
|
+
* @param {Object[keyof Object]} value The value of key that identifies the object being searched for
|
|
75
|
+
* @returns {number | undefined} The index of the queried object or undefined if no index was found
|
|
76
|
+
*
|
|
77
|
+
*/
|
|
78
|
+
declare function indexOf<O extends object, K extends keyof O>(arr: O[], key: K, value: O[K]): number | undefined;
|
|
79
|
+
declare function formatInvoiceNo(invoiceNo: string): string;
|
|
80
|
+
declare function formatGCTRegNo(regNo: string): string;
|
|
81
|
+
declare function indices(arr: unknown[]): number[];
|
|
82
|
+
declare function hasIndex(arr: unknown[], index: number): boolean;
|
|
83
|
+
declare function repeat<T>(count: number, func: (idx: number) => T): void;
|
|
84
|
+
declare function isLetter(value: string): boolean;
|
|
85
|
+
declare function isNumber(value: string): boolean;
|
|
86
|
+
declare function count(searchFor: unknown, arrayish: string | unknown[]): number;
|
|
87
|
+
declare function subObjectList<T>(value: {
|
|
88
|
+
key: string;
|
|
89
|
+
value: unknown;
|
|
90
|
+
}, array: {
|
|
91
|
+
[key: string]: T;
|
|
92
|
+
}[]): {
|
|
93
|
+
[key: string]: T;
|
|
94
|
+
}[];
|
|
95
|
+
declare function random(max: number, min?: number): number;
|
|
96
|
+
declare function undefinedIfEmpty(value: string): string | undefined;
|
|
97
|
+
declare function ifEmpty<T>(value: T[] | string, fallback: unknown): unknown;
|
|
98
|
+
declare function windowed<T>(arr: T[], count: number): T[][];
|
|
99
|
+
declare function group<T>(arr: T[], isGroup: (comp1: T, comp2: T) => boolean): T[][];
|
|
100
|
+
/**
|
|
101
|
+
*
|
|
102
|
+
* @param arr The generic array to filter
|
|
103
|
+
* @returns An array without nullish values.
|
|
104
|
+
*/
|
|
105
|
+
declare function strictArray<T>(arr: T[]): T[];
|
|
106
|
+
declare function maxOf(arr: number[]): number;
|
|
107
|
+
declare function minOf(arr: number[]): number;
|
|
108
|
+
declare function averageOf(arr: number[]): number;
|
|
109
|
+
declare function run<T, R>(value: T, fn: (value: T) => R): R;
|
|
110
|
+
declare function asyncRun<T, R>(value: T, fn: (value: T) => R): Promise<R>;
|
|
111
|
+
declare function coerceIn(arr: number[], min: number, max: number): number[];
|
|
112
|
+
declare function sort<T extends object>(arr: T[], sortBy: keyof T, order?: "asc" | "dsc"): T[];
|
|
113
|
+
declare function sumOf(value: number[]): number;
|
|
114
|
+
declare function insertAt<T>(arr: T[], index: number, value: T): T[];
|
|
115
|
+
declare function overwrite<T>(arr: T[], index: number, newValue: T): T[];
|
|
116
|
+
declare function take<T>(value: T[], amount: number): T[];
|
|
117
|
+
declare function takeWhile<T>(value: T[], fn: (value: T, index: number) => boolean): T[];
|
|
118
|
+
declare function takeLast<T>(arr: T[], amount?: number): T[];
|
|
119
|
+
declare function takeLastWhile<T>(value: T[], fn: (value: T, index: number) => boolean): T[];
|
|
120
|
+
declare function drop<T>(arr: T[], count?: number): T[];
|
|
121
|
+
declare function dropWhile<T>(arr: T[], fn: (value: T, idx: number) => boolean): T[];
|
|
122
|
+
/**
|
|
123
|
+
*
|
|
124
|
+
* @param count The amount of items to remove from the end of the array `default = 1`
|
|
125
|
+
* @returns a copy of the array without the removed items
|
|
126
|
+
*/
|
|
127
|
+
declare function dropLast<T>(arr: T[], count?: number): T[];
|
|
128
|
+
declare function dropLastWhile<T>(arr: T[], fn: (value: T, idx: number) => boolean): T[];
|
|
129
|
+
/**
|
|
130
|
+
*
|
|
131
|
+
* @param dataSource An array of generic objects that should be searched.
|
|
132
|
+
* @param queryProperty A property name, from the generic object, which is used as the 'source of truth'.
|
|
133
|
+
* @param searchFor The value to search for that correlates with the queryProperty.
|
|
134
|
+
* @returns A filtered version of the dataSource, where each object is congruent with the search.
|
|
135
|
+
*/
|
|
136
|
+
declare function dataSearcher<DataType extends object, Key extends keyof DataType>(dataSource: DataType[], queryProperty: Key, searchFor: DataType[Key], options?: {
|
|
137
|
+
strictEquality?: boolean;
|
|
138
|
+
}): DataType[];
|
|
139
|
+
declare function inRange(value: number, min: number, max: number, options?: {
|
|
140
|
+
excludeMin?: boolean;
|
|
141
|
+
excludeMax?: boolean;
|
|
142
|
+
excludeBoth?: boolean;
|
|
143
|
+
}): boolean;
|
|
144
|
+
declare function negate(condition: boolean, negate: boolean): boolean;
|
|
145
|
+
declare function removeAll(str: string, remove: string): string;
|
|
146
|
+
declare function mapToArray<K extends string | number | symbol, V>(map: Map<K, V>): {
|
|
147
|
+
[Key in K]: V;
|
|
148
|
+
}[];
|
|
149
|
+
declare function distinct<T>(arr: T[]): T[];
|
|
150
|
+
declare function map<To extends object, From extends object>(from: From, mappedFields: Record<keyof From, keyof To>): To;
|
|
151
|
+
declare function isEmpty(value: string | unknown[]): boolean;
|
|
152
|
+
declare function ifDefined<T, R>(value: T | undefined, cb: (value: T) => R): R | undefined;
|
|
153
|
+
declare function someValuesEmpty<O extends {
|
|
154
|
+
[key: string | number | symbol]: string | unknown[];
|
|
155
|
+
}>(obj: O): boolean;
|
|
156
|
+
declare function poll<T>(getValue: () => T, interval?: number): Promise<Awaited<T> & ({} | null)>;
|
|
157
|
+
declare function inferFilename(filePath: string): string;
|
|
158
|
+
declare function getFileExt(filePath: string): string;
|
|
159
|
+
declare function copyToClipboard(text: string): Promise<TaskResult>;
|
|
160
|
+
declare function readClipboardText(): Promise<TaskResult<{
|
|
161
|
+
text: string;
|
|
162
|
+
}>>;
|
|
163
|
+
declare function arrayWithConst<T>(array: T[]): {
|
|
164
|
+
value: T[];
|
|
165
|
+
asConst: readonly T[];
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
declare const serverDataAdapter: {
|
|
169
|
+
<DataType extends {
|
|
170
|
+
[key: string]: any;
|
|
171
|
+
}>(event: "zip", data: DataType): FromServer<DataType>;
|
|
172
|
+
<DataType extends {
|
|
173
|
+
[key: string]: any;
|
|
174
|
+
}>(event: "unzip", data: DataType): NormalizeFromServer<DataType>;
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
export { addArticle, arrayWithConst, asyncRun, averageOf, blankSpaces, buildArray, camelCaseToLetter, classNameExt, classNameResolver, coerceIn, copyToClipboard, count, dataSearcher, distinct, drop, dropLast, dropLastWhile, dropWhile, format, formatGCTRegNo, formatInvoiceNo, getCaps, getFileExt, group, hasIndex, ifDefined, ifEmpty, inRange, indexOf, indices, inferFilename, insertAt, isEmpty, isFile, isLetter, isNumber, lastIndex, map, mapToArray, maxOf, minOf, negate, ordinalIndicator, overwrite, pluralize, poll, random, range, readClipboardText, removeAll, repeat, run, serverDataAdapter, someValuesEmpty, sort, strictArray, stringToSearch, subObjectList, sumOf, take, takeLast, takeLastWhile, takeWhile, timeDuration, toNumber, toObject, trimString, undefinedIfEmpty, upperFirst, windowed };
|
package/dist/main.d.ts
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import "@wavy/types"
|
|
2
|
+
type DateFormat = "MMM dd, yyyy" | "MMM dd, yyyy | HH:mm A" | "MMM dd, yyyy at HH:mm A" | "MMMM" | "yyyy" | "MMM yyyy" | "mm/dd/yyyy" | "mm/dd/yyyy HH:mm A" | "HH:mm A";
|
|
3
|
+
|
|
4
|
+
type NumberFormatterTypes = {
|
|
5
|
+
formats: "money";
|
|
6
|
+
options: {
|
|
7
|
+
money?: {
|
|
8
|
+
showSigns?: boolean;
|
|
9
|
+
truncate?: boolean;
|
|
10
|
+
excludeDollarSign?: boolean;
|
|
11
|
+
dropDecimals?: boolean;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
declare class StringFormatter {
|
|
17
|
+
static vowels: string;
|
|
18
|
+
static caseConverter: {
|
|
19
|
+
camelToLetter: (camelCase: string) => string;
|
|
20
|
+
};
|
|
21
|
+
static extract: {
|
|
22
|
+
capitalLetters: (value: string, count?: number) => string[];
|
|
23
|
+
};
|
|
24
|
+
static trimString(value: string, trim: string): string;
|
|
25
|
+
static pluralize(value: string): string;
|
|
26
|
+
static addArticle(value: string, article: "a/an"): string;
|
|
27
|
+
static toSearch(from: string): string;
|
|
28
|
+
static toMoney(from: string, options?: NumberFormatterTypes["options"]["money"]): string;
|
|
29
|
+
static toTRN(from: string): string;
|
|
30
|
+
static toNumber(value: string): number;
|
|
31
|
+
static upperFirst(value: string): string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
declare const dateFormat: (time: number | Date | "now", format?: DateFormat) => string;
|
|
35
|
+
declare const timeDuration: (from: number, to: number, options?: {
|
|
36
|
+
disableRemainder?: boolean;
|
|
37
|
+
abvUnits?: boolean;
|
|
38
|
+
}) => string;
|
|
39
|
+
declare const upperFirst: typeof StringFormatter.upperFirst;
|
|
40
|
+
declare const camelCaseToLetter: (camelCase: string) => string;
|
|
41
|
+
declare const trimString: typeof StringFormatter.trimString;
|
|
42
|
+
declare const stringToSearch: typeof StringFormatter.toSearch;
|
|
43
|
+
declare const getCaps: (value: string, count?: number) => string[];
|
|
44
|
+
declare const toNumber: typeof StringFormatter.toNumber;
|
|
45
|
+
declare const addArticle: typeof StringFormatter.addArticle;
|
|
46
|
+
declare const pluralize: typeof StringFormatter.pluralize;
|
|
47
|
+
declare const nameToString: (name: Name | undefined) => string;
|
|
48
|
+
declare const phoneNoToString: (phoneNumber: PhoneNumber | undefined) => string;
|
|
49
|
+
declare const addressToString: (address: Address | undefined, inline?: boolean) => string;
|
|
50
|
+
declare const toMoney: (value: string | number, options?: NumberFormatterTypes["options"]["money"]) => string;
|
|
51
|
+
declare function format<Event extends "date" | "money" | "name" | "phone-number" | "address">(event: Event, ...args: Event extends "date" ? Parameters<typeof dateFormat> : Event extends "money" ? Parameters<typeof toMoney> : Event extends "name" ? Parameters<typeof nameToString> : Event extends "phone-number" ? Parameters<typeof phoneNoToString> : Event extends "address" ? Parameters<typeof addressToString> : never): Event extends "date" ? ReturnType<typeof dateFormat> : Event extends "money" ? ReturnType<typeof toMoney> : Event extends "name" ? ReturnType<typeof nameToString> : Event extends "phone-number" ? ReturnType<typeof phoneNoToString> : Event extends "address" ? ReturnType<typeof addressToString> : never;
|
|
52
|
+
declare function isFile(obj: unknown): obj is File;
|
|
53
|
+
declare function toObject<O extends File>(object: O, ...args: O extends File ? [
|
|
54
|
+
options?: Partial<{
|
|
55
|
+
uploadDate: number | "now";
|
|
56
|
+
description: string;
|
|
57
|
+
filepath: string;
|
|
58
|
+
filename: string;
|
|
59
|
+
typeAlias: LocalFile["typeAlias"];
|
|
60
|
+
}>
|
|
61
|
+
] : []): O extends File ? LocalFile | undefined : void;
|
|
62
|
+
declare function classNameResolver(baseClassName: string): (className: string) => string;
|
|
63
|
+
declare function classNameExt(rootClassName: string): (className: string) => string;
|
|
64
|
+
declare function range(start: number, end: number): number[];
|
|
65
|
+
declare function lastIndex(value: string | unknown[]): number;
|
|
66
|
+
declare function buildArray<T>(length: number, func: (idx: number) => T): T[];
|
|
67
|
+
declare function blankSpaces(count: number): string;
|
|
68
|
+
declare function ordinalIndicator(amount: number): string;
|
|
69
|
+
/**
|
|
70
|
+
*
|
|
71
|
+
*
|
|
72
|
+
* @param {Array<Object>} arr The array of generic objects to search
|
|
73
|
+
* @param {keyof Object} key The property to use when querying/finding an object
|
|
74
|
+
* @param {Object[keyof Object]} value The value of key that identifies the object being searched for
|
|
75
|
+
* @returns {number | undefined} The index of the queried object or undefined if no index was found
|
|
76
|
+
*
|
|
77
|
+
*/
|
|
78
|
+
declare function indexOf<O extends object, K extends keyof O>(arr: O[], key: K, value: O[K]): number | undefined;
|
|
79
|
+
declare function formatInvoiceNo(invoiceNo: string): string;
|
|
80
|
+
declare function formatGCTRegNo(regNo: string): string;
|
|
81
|
+
declare function indices(arr: unknown[]): number[];
|
|
82
|
+
declare function hasIndex(arr: unknown[], index: number): boolean;
|
|
83
|
+
declare function repeat<T>(count: number, func: (idx: number) => T): void;
|
|
84
|
+
declare function isLetter(value: string): boolean;
|
|
85
|
+
declare function isNumber(value: string): boolean;
|
|
86
|
+
declare function count(searchFor: unknown, arrayish: string | unknown[]): number;
|
|
87
|
+
declare function subObjectList<T>(value: {
|
|
88
|
+
key: string;
|
|
89
|
+
value: unknown;
|
|
90
|
+
}, array: {
|
|
91
|
+
[key: string]: T;
|
|
92
|
+
}[]): {
|
|
93
|
+
[key: string]: T;
|
|
94
|
+
}[];
|
|
95
|
+
declare function random(max: number, min?: number): number;
|
|
96
|
+
declare function undefinedIfEmpty(value: string): string | undefined;
|
|
97
|
+
declare function ifEmpty<T>(value: T[] | string, fallback: unknown): unknown;
|
|
98
|
+
declare function windowed<T>(arr: T[], count: number): T[][];
|
|
99
|
+
declare function group<T>(arr: T[], isGroup: (comp1: T, comp2: T) => boolean): T[][];
|
|
100
|
+
/**
|
|
101
|
+
*
|
|
102
|
+
* @param arr The generic array to filter
|
|
103
|
+
* @returns An array without nullish values.
|
|
104
|
+
*/
|
|
105
|
+
declare function strictArray<T>(arr: T[]): T[];
|
|
106
|
+
declare function maxOf(arr: number[]): number;
|
|
107
|
+
declare function minOf(arr: number[]): number;
|
|
108
|
+
declare function averageOf(arr: number[]): number;
|
|
109
|
+
declare function run<T, R>(value: T, fn: (value: T) => R): R;
|
|
110
|
+
declare function asyncRun<T, R>(value: T, fn: (value: T) => R): Promise<R>;
|
|
111
|
+
declare function coerceIn(arr: number[], min: number, max: number): number[];
|
|
112
|
+
declare function sort<T extends object>(arr: T[], sortBy: keyof T, order?: "asc" | "dsc"): T[];
|
|
113
|
+
declare function sumOf(value: number[]): number;
|
|
114
|
+
declare function insertAt<T>(arr: T[], index: number, value: T): T[];
|
|
115
|
+
declare function overwrite<T>(arr: T[], index: number, newValue: T): T[];
|
|
116
|
+
declare function take<T>(value: T[], amount: number): T[];
|
|
117
|
+
declare function takeWhile<T>(value: T[], fn: (value: T, index: number) => boolean): T[];
|
|
118
|
+
declare function takeLast<T>(arr: T[], amount?: number): T[];
|
|
119
|
+
declare function takeLastWhile<T>(value: T[], fn: (value: T, index: number) => boolean): T[];
|
|
120
|
+
declare function drop<T>(arr: T[], count?: number): T[];
|
|
121
|
+
declare function dropWhile<T>(arr: T[], fn: (value: T, idx: number) => boolean): T[];
|
|
122
|
+
/**
|
|
123
|
+
*
|
|
124
|
+
* @param count The amount of items to remove from the end of the array `default = 1`
|
|
125
|
+
* @returns a copy of the array without the removed items
|
|
126
|
+
*/
|
|
127
|
+
declare function dropLast<T>(arr: T[], count?: number): T[];
|
|
128
|
+
declare function dropLastWhile<T>(arr: T[], fn: (value: T, idx: number) => boolean): T[];
|
|
129
|
+
/**
|
|
130
|
+
*
|
|
131
|
+
* @param dataSource An array of generic objects that should be searched.
|
|
132
|
+
* @param queryProperty A property name, from the generic object, which is used as the 'source of truth'.
|
|
133
|
+
* @param searchFor The value to search for that correlates with the queryProperty.
|
|
134
|
+
* @returns A filtered version of the dataSource, where each object is congruent with the search.
|
|
135
|
+
*/
|
|
136
|
+
declare function dataSearcher<DataType extends object, Key extends keyof DataType>(dataSource: DataType[], queryProperty: Key, searchFor: DataType[Key], options?: {
|
|
137
|
+
strictEquality?: boolean;
|
|
138
|
+
}): DataType[];
|
|
139
|
+
declare function inRange(value: number, min: number, max: number, options?: {
|
|
140
|
+
excludeMin?: boolean;
|
|
141
|
+
excludeMax?: boolean;
|
|
142
|
+
excludeBoth?: boolean;
|
|
143
|
+
}): boolean;
|
|
144
|
+
declare function negate(condition: boolean, negate: boolean): boolean;
|
|
145
|
+
declare function removeAll(str: string, remove: string): string;
|
|
146
|
+
declare function mapToArray<K extends string | number | symbol, V>(map: Map<K, V>): {
|
|
147
|
+
[Key in K]: V;
|
|
148
|
+
}[];
|
|
149
|
+
declare function distinct<T>(arr: T[]): T[];
|
|
150
|
+
declare function map<To extends object, From extends object>(from: From, mappedFields: Record<keyof From, keyof To>): To;
|
|
151
|
+
declare function isEmpty(value: string | unknown[]): boolean;
|
|
152
|
+
declare function ifDefined<T, R>(value: T | undefined, cb: (value: T) => R): R | undefined;
|
|
153
|
+
declare function someValuesEmpty<O extends {
|
|
154
|
+
[key: string | number | symbol]: string | unknown[];
|
|
155
|
+
}>(obj: O): boolean;
|
|
156
|
+
declare function poll<T>(getValue: () => T, interval?: number): Promise<Awaited<T> & ({} | null)>;
|
|
157
|
+
declare function inferFilename(filePath: string): string;
|
|
158
|
+
declare function getFileExt(filePath: string): string;
|
|
159
|
+
declare function copyToClipboard(text: string): Promise<TaskResult>;
|
|
160
|
+
declare function readClipboardText(): Promise<TaskResult<{
|
|
161
|
+
text: string;
|
|
162
|
+
}>>;
|
|
163
|
+
declare function arrayWithConst<T>(array: T[]): {
|
|
164
|
+
value: T[];
|
|
165
|
+
asConst: readonly T[];
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
declare const serverDataAdapter: {
|
|
169
|
+
<DataType extends {
|
|
170
|
+
[key: string]: any;
|
|
171
|
+
}>(event: "zip", data: DataType): FromServer<DataType>;
|
|
172
|
+
<DataType extends {
|
|
173
|
+
[key: string]: any;
|
|
174
|
+
}>(event: "unzip", data: DataType): NormalizeFromServer<DataType>;
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
export { addArticle, arrayWithConst, asyncRun, averageOf, blankSpaces, buildArray, camelCaseToLetter, classNameExt, classNameResolver, coerceIn, copyToClipboard, count, dataSearcher, distinct, drop, dropLast, dropLastWhile, dropWhile, format, formatGCTRegNo, formatInvoiceNo, getCaps, getFileExt, group, hasIndex, ifDefined, ifEmpty, inRange, indexOf, indices, inferFilename, insertAt, isEmpty, isFile, isLetter, isNumber, lastIndex, map, mapToArray, maxOf, minOf, negate, ordinalIndicator, overwrite, pluralize, poll, random, range, readClipboardText, removeAll, repeat, run, serverDataAdapter, someValuesEmpty, sort, strictArray, stringToSearch, subObjectList, sumOf, take, takeLast, takeLastWhile, takeWhile, timeDuration, toNumber, toObject, trimString, undefinedIfEmpty, upperFirst, windowed };
|