@noah-libjs/utils 0.0.3 → 0.0.4

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.
@@ -0,0 +1,919 @@
1
+ import dayjs, { ConfigType, QUnitType, OpUnitType } from 'dayjs';
2
+ export { default as dayjs } from 'dayjs';
3
+
4
+ interface ICommonOption {
5
+ value?: any;
6
+ label?: string;
7
+ prefix?: string;
8
+ sufix?: string;
9
+ suffix?: string;
10
+ props?: any;
11
+ warning?: boolean;
12
+ parentheses?: boolean;
13
+ exclusive?: boolean;
14
+ inputType?: string;
15
+ id?: any;
16
+ text?: any;
17
+ code?: any;
18
+ }
19
+
20
+ /**
21
+ * Sorts an array of items into groups. The return value is a map where the keys are
22
+ * the group ids the given getGroupId function produced and the value is an array of
23
+ * each item in that group.
24
+ */
25
+ declare const group: <T, Key extends string | number | symbol>(array: readonly T[], getGroupId: (item: T) => Key) => Partial<Record<Key, T[]>>;
26
+ /**
27
+ * Creates an array of grouped elements, the first of which contains the
28
+ * first elements of the given arrays, the second of which contains the
29
+ * second elements of the given arrays, and so on.
30
+ *
31
+ * Ex. const zipped = zip(['a', 'b'], [1, 2], [true, false]) // [['a', 1, true], ['b', 2, false]]
32
+ */
33
+ declare function zip<T1, T2, T3, T4, T5>(array1: T1[], array2: T2[], array3: T3[], array4: T4[], array5: T5[]): [T1, T2, T3, T4, T5][];
34
+ declare function zip<T1, T2, T3, T4>(array1: T1[], array2: T2[], array3: T3[], array4: T4[]): [T1, T2, T3, T4][];
35
+ declare function zip<T1, T2, T3>(array1: T1[], array2: T2[], array3: T3[]): [T1, T2, T3][];
36
+ declare function zip<T1, T2>(array1: T1[], array2: T2[]): [T1, T2][];
37
+ /**
38
+ * Creates an object mapping the specified keys to their corresponding values
39
+ *
40
+ * Ex. const zipped = zipToObject(['a', 'b'], [1, 2]) // { a: 1, b: 2 }
41
+ * Ex. const zipped = zipToObject(['a', 'b'], (k, i) => k + i) // { a: 'a0', b: 'b1' }
42
+ * Ex. const zipped = zipToObject(['a', 'b'], 1) // { a: 1, b: 1 }
43
+ */
44
+ declare function zipToObject<K extends string | number | symbol, V>(keys: K[], values: V | ((key: K, idx: number) => V) | V[]): Record<K, V>;
45
+ /**
46
+ * Go through a list of items, starting with the first item,
47
+ * and comparing with the second. Keep the one you want then
48
+ * compare that to the next item in the list with the same
49
+ *
50
+ * Ex. const greatest = () => boil(numbers, (a, b) => a > b)
51
+ */
52
+ declare const boil: <T>(array: readonly T[], compareFunc: (a: T, b: T) => T) => T | null;
53
+ /**
54
+ * Sum all numbers in an array. Optionally provide a function
55
+ * to convert objects in the array to number values.
56
+ */
57
+ declare function sum<T extends number>(array: readonly T[]): number;
58
+ declare function sum<T extends object>(array: readonly T[], fn: (item: T) => number): number;
59
+ /**
60
+ * Get the first item in an array or a default value
61
+ */
62
+ declare const first: <T>(array: readonly T[], defaultValue?: T | null | undefined) => T | null | undefined;
63
+ /**
64
+ * Get the last item in an array or a default value
65
+ */
66
+ declare const last: <T>(array: readonly T[], defaultValue?: T | null | undefined) => T | null | undefined;
67
+ /**
68
+ * Sort an array without modifying it and return
69
+ * the newly sorted value
70
+ */
71
+ declare const sort: <T>(array: readonly T[], getter: (item: T) => number, desc?: boolean) => T[];
72
+ /**
73
+ * Sort an array without modifying it and return
74
+ * the newly sorted value. Allows for a string
75
+ * sorting value.
76
+ */
77
+ declare const alphabetical: <T>(array: readonly T[], getter: (item: T) => string, dir?: 'asc' | 'desc') => T[];
78
+ declare const counting: <T, TId extends string | number | symbol>(list: readonly T[], identity: (item: T) => TId) => Record<TId, number>;
79
+ /**
80
+ * Replace an element in an array with a new
81
+ * item without modifying the array and return
82
+ * the new value
83
+ */
84
+ declare const replace: <T>(list: readonly T[], newItem: T, match: (item: T, idx: number) => boolean) => T[];
85
+ /**
86
+ * Convert an array to a dictionary by mapping each item
87
+ * into a dictionary key & value
88
+ */
89
+ declare const objectify: <T, Key extends string | number | symbol, Value = T>(array: readonly T[], getKey: (item: T) => Key, getValue?: (item: T) => Value) => Record<Key, Value>;
90
+ /**
91
+ * Select performs a filter and a mapper inside of a reduce,
92
+ * only iterating the list one time.
93
+ *
94
+ * @example
95
+ * select([1, 2, 3, 4], x => x*x, x > 2) == [9, 16]
96
+ */
97
+ declare const select: <T, K>(array: readonly T[], mapper: (item: T, index: number) => K, condition: (item: T, index: number) => boolean) => K[];
98
+ /**
99
+ * Max gets the greatest value from a list
100
+ *
101
+ * @example
102
+ * max([ 2, 3, 5]) == 5
103
+ * max([{ num: 1 }, { num: 2 }], x => x.num) == { num: 2 }
104
+ */
105
+ declare function max(array: readonly [number, ...number[]]): number;
106
+ declare function max(array: readonly number[]): number | null;
107
+ declare function max<T>(array: readonly T[], getter: (item: T) => number): T | null;
108
+ /**
109
+ * Min gets the smallest value from a list
110
+ *
111
+ * @example
112
+ * min([1, 2, 3, 4]) == 1
113
+ * min([{ num: 1 }, { num: 2 }], x => x.num) == { num: 1 }
114
+ */
115
+ declare function min(array: readonly [number, ...number[]]): number;
116
+ declare function min(array: readonly number[]): number | null;
117
+ declare function min<T>(array: readonly T[], getter: (item: T) => number): T | null;
118
+ /**
119
+ * Splits a single list into many lists of the desired size. If
120
+ * given a list of 10 items and a size of 2, it will return 5
121
+ * lists with 2 items each
122
+ */
123
+ declare const cluster: <T>(list: readonly T[], size?: number) => T[][];
124
+ /**
125
+ * Given a list of items returns a new list with only
126
+ * unique items. Accepts an optional identity function
127
+ * to convert each item in the list to a comparable identity
128
+ * value
129
+ */
130
+ declare const unique: <T, K extends string | number | symbol>(array: readonly T[], toKey?: ((item: T) => K) | undefined) => T[];
131
+ /**
132
+ * Creates a generator that will produce an iteration through
133
+ * the range of number as requested.
134
+ *
135
+ * @example
136
+ * range(3) // yields 0, 1, 2, 3
137
+ * range(0, 3) // yields 0, 1, 2, 3
138
+ * range(0, 3, 'y') // yields y, y, y, y
139
+ * range(0, 3, () => 'y') // yields y, y, y, y
140
+ * range(0, 3, i => i) // yields 0, 1, 2, 3
141
+ * range(0, 3, i => `y${i}`) // yields y0, y1, y2, y3
142
+ * range(0, 3, obj) // yields obj, obj, obj, obj
143
+ * range(0, 6, i => i, 2) // yields 0, 2, 4, 6
144
+ */
145
+ declare function range<T = number>(startOrLength: number, end?: number, valueOrMapper?: T | ((i: number) => T), step?: number): Generator<T>;
146
+ /**
147
+ * Creates a list of given start, end, value, and
148
+ * step parameters.
149
+ *
150
+ * @example
151
+ * list(3) // 0, 1, 2, 3
152
+ * list(0, 3) // 0, 1, 2, 3
153
+ * list(0, 3, 'y') // y, y, y, y
154
+ * list(0, 3, () => 'y') // y, y, y, y
155
+ * list(0, 3, i => i) // 0, 1, 2, 3
156
+ * list(0, 3, i => `y${i}`) // y0, y1, y2, y3
157
+ * list(0, 3, obj) // obj, obj, obj, obj
158
+ * list(0, 6, i => i, 2) // 0, 2, 4, 6
159
+ */
160
+ declare const list: <T = number>(startOrLength: number, end?: number, valueOrMapper?: T | ((i: number) => T) | undefined, step?: number) => T[];
161
+ /**
162
+ * Given an array of arrays, returns a single
163
+ * dimentional array with all items in it.
164
+ */
165
+ declare const flat: <T>(lists: readonly T[][]) => T[];
166
+ /**
167
+ * Given two arrays, returns true if any
168
+ * elements intersect
169
+ */
170
+ declare const intersects: <T, K extends string | number | symbol>(listA: readonly T[], listB: readonly T[], identity?: ((t: T) => K) | undefined) => boolean;
171
+ /**
172
+ * Split an array into two array based on
173
+ * a true/false condition function
174
+ */
175
+ declare const fork: <T>(list: readonly T[], condition: (item: T) => boolean) => [T[], T[]];
176
+ /**
177
+ * Given two lists of the same type, iterate the first list
178
+ * and replace items matched by the matcher func in the
179
+ * first place.
180
+ */
181
+ declare const merge: <T>(root: readonly T[], others: readonly T[], matcher: (item: T) => any) => readonly T[];
182
+ /**
183
+ * Replace an item in an array by a match function condition. If
184
+ * no items match the function condition, appends the new item to
185
+ * the end of the list.
186
+ */
187
+ declare const replaceOrAppend: <T>(list: readonly T[], newItem: T, match: (a: T, idx: number) => boolean) => T[];
188
+ /**
189
+ * If the item matching the condition already exists
190
+ * in the list it will be removed. If it does not it
191
+ * will be added.
192
+ */
193
+ declare const toggle: <T>(list: readonly T[], item: T, toKey?: ((item: T, idx: number) => number | string | symbol) | null | undefined, options?: {
194
+ strategy?: 'prepend' | 'append';
195
+ }) => T[];
196
+ type Falsy = null | undefined | false | '' | 0 | 0n;
197
+ /**
198
+ * Given a list returns a new list with
199
+ * only truthy values
200
+ */
201
+ declare const sift: <T>(list: readonly (Falsy | T)[]) => T[];
202
+ /**
203
+ * Like a reduce but does not require an array.
204
+ * Only need a number and will iterate the function
205
+ * as many times as specified.
206
+ *
207
+ * NOTE: This is NOT zero indexed. If you pass count=5
208
+ * you will get 1, 2, 3, 4, 5 iteration in the callback
209
+ * function
210
+ */
211
+ declare const iterate: <T>(count: number, func: (currentValue: T, iteration: number) => T, initValue: T) => T;
212
+ /**
213
+ * Returns all items from the first list that
214
+ * do not exist in the second list.
215
+ */
216
+ declare const diff: <T>(root: readonly T[], other: readonly T[], identity?: (item: T) => string | number | symbol) => T[];
217
+ /**
218
+ * Shift array items by n steps
219
+ * If n > 0 items will shift n steps to the right
220
+ * If n < 0 items will shift n steps to the left
221
+ */
222
+ declare function shift<T>(arr: Array<T>, n: number): T[];
223
+
224
+ /**
225
+ * An async reduce function. Works like the
226
+ * built-in Array.reduce function but handles
227
+ * an async reducer function
228
+ */
229
+ declare const reduce: <T, K>(array: readonly T[], asyncReducer: (acc: K, item: T, index: number) => Promise<K>, initValue?: K | undefined) => Promise<K>;
230
+ /**
231
+ * An async map function. Works like the
232
+ * built-in Array.map function but handles
233
+ * an async mapper function
234
+ */
235
+ declare const map: <T, K>(array: readonly T[], asyncMapFunc: (item: T, index: number) => Promise<K>) => Promise<K[]>;
236
+ /**
237
+ * Useful when for script like things where cleanup
238
+ * should be done on fail or sucess no matter.
239
+ *
240
+ * You can call defer many times to register many
241
+ * defered functions that will all be called when
242
+ * the function exits in any state.
243
+ */
244
+ declare const defer: <TResponse>(func: (register: (fn: (error?: any) => any, options?: {
245
+ rethrow?: boolean;
246
+ }) => void) => Promise<TResponse>) => Promise<TResponse>;
247
+ /**
248
+ * Support for the built-in AggregateError
249
+ * is still new. Node < 15 doesn't have it
250
+ * so patching here.
251
+ * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/AggregateError#browser_compatibility
252
+ */
253
+ declare class AggregateError extends Error {
254
+ errors: Error[];
255
+ constructor(errors?: Error[]);
256
+ }
257
+ /**
258
+ * Executes many async functions in parallel. Returns the
259
+ * results from all functions as an array. After all functions
260
+ * have resolved, if any errors were thrown, they are rethrown
261
+ * in an instance of AggregateError
262
+ */
263
+ declare const parallel: <T, K>(limit: number, array: readonly T[], func: (item: T) => Promise<K>) => Promise<K[]>;
264
+ type PromiseValues<T extends Promise<any>[]> = {
265
+ [K in keyof T]: T[K] extends Promise<infer U> ? U : never;
266
+ };
267
+ /**
268
+ * Functionally similar to Promise.all or Promise.allSettled. If any
269
+ * errors are thrown, all errors are gathered and thrown in an
270
+ * AggregateError.
271
+ *
272
+ * @example
273
+ * const [user] = await all([
274
+ * api.users.create(...),
275
+ * s3.buckets.create(...),
276
+ * slack.customerSuccessChannel.sendMessage(...)
277
+ * ])
278
+ */
279
+ declare function all<T extends [Promise<any>, ...Promise<any>[]]>(promises: T): Promise<PromiseValues<T>>;
280
+ declare function all<T extends Promise<any>[]>(promises: T): Promise<PromiseValues<T>>;
281
+ /**
282
+ * Functionally similar to Promise.all or Promise.allSettled. If any
283
+ * errors are thrown, all errors are gathered and thrown in an
284
+ * AggregateError.
285
+ *
286
+ * @example
287
+ * const { user } = await all({
288
+ * user: api.users.create(...),
289
+ * bucket: s3.buckets.create(...),
290
+ * message: slack.customerSuccessChannel.sendMessage(...)
291
+ * })
292
+ */
293
+ declare function all<T extends Record<string, Promise<any>>>(promises: T): Promise<{
294
+ [K in keyof T]: Awaited<T[K]>;
295
+ }>;
296
+ /**
297
+ * Retries the given function the specified number
298
+ * of times.
299
+ */
300
+ declare const retry: <TResponse>(options: {
301
+ times?: number | undefined;
302
+ delay?: number | null | undefined;
303
+ backoff?: ((count: number) => number) | undefined;
304
+ }, func: (exit: (err: any) => void) => Promise<TResponse>) => Promise<TResponse>;
305
+ /**
306
+ * Async wait
307
+ */
308
+ declare const sleep: (milliseconds: number) => Promise<unknown>;
309
+ /**
310
+ * A helper to try an async function without forking
311
+ * the control flow. Returns an error first callback _like_
312
+ * array response as [Error, result]
313
+ */
314
+ declare const tryit: <Args extends any[], Return>(func: (...args: Args) => Return) => (...args: Args) => Return extends Promise<any> ? Promise<[Error, undefined] | [undefined, Awaited<Return>]> : [Error, undefined] | [undefined, Return];
315
+ /**
316
+ * A helper to try an async function that returns undefined
317
+ * if it fails.
318
+ *
319
+ * e.g. const result = await guard(fetchUsers)() ?? [];
320
+ */
321
+ declare const guard: <TFunction extends () => any>(func: TFunction, shouldGuard?: ((err: any) => boolean) | undefined) => ReturnType<TFunction> extends Promise<any> ? Promise<Awaited<ReturnType<TFunction>> | undefined> : ReturnType<TFunction> | undefined;
322
+
323
+ declare function chain<T1 extends any[], T2, T3>(f1: (...arg: T1) => T2, f2: (arg: T2) => T3): (...arg: T1) => T3;
324
+ declare function chain<T1 extends any[], T2, T3, T4>(f1: (...arg: T1) => T2, f2: (arg: T2) => T3, f3: (arg: T3) => T4): (...arg: T1) => T4;
325
+ declare function chain<T1 extends any[], T2, T3, T4, T5>(f1: (...arg: T1) => T2, f2: (arg: T2) => T3, f3: (arg: T3) => T4, f4: (arg: T3) => T5): (...arg: T1) => T5;
326
+ declare function chain<T1 extends any[], T2, T3, T4, T5, T6>(f1: (...arg: T1) => T2, f2: (arg: T2) => T3, f3: (arg: T3) => T4, f4: (arg: T3) => T5, f5: (arg: T3) => T6): (...arg: T1) => T6;
327
+ declare function chain<T1 extends any[], T2, T3, T4, T5, T6, T7>(f1: (...arg: T1) => T2, f2: (arg: T2) => T3, f3: (arg: T3) => T4, f4: (arg: T3) => T5, f5: (arg: T3) => T6, f6: (arg: T3) => T7): (...arg: T1) => T7;
328
+ declare function chain<T1 extends any[], T2, T3, T4, T5, T6, T7, T8>(f1: (...arg: T1) => T2, f2: (arg: T2) => T3, f3: (arg: T3) => T4, f4: (arg: T3) => T5, f5: (arg: T3) => T6, f6: (arg: T3) => T7, f7: (arg: T3) => T8): (...arg: T1) => T8;
329
+ declare function chain<T1 extends any[], T2, T3, T4, T5, T6, T7, T8, T9>(f1: (...arg: T1) => T2, f2: (arg: T2) => T3, f3: (arg: T3) => T4, f4: (arg: T3) => T5, f5: (arg: T3) => T6, f6: (arg: T3) => T7, f7: (arg: T3) => T8, f8: (arg: T3) => T9): (...arg: T1) => T9;
330
+ declare function chain<T1 extends any[], T2, T3, T4, T5, T6, T7, T8, T9, T10>(f1: (...arg: T1) => T2, f2: (arg: T2) => T3, f3: (arg: T3) => T4, f4: (arg: T3) => T5, f5: (arg: T3) => T6, f6: (arg: T3) => T7, f7: (arg: T3) => T8, f8: (arg: T3) => T9, f9: (arg: T3) => T10): (...arg: T1) => T10;
331
+ declare function chain<T1 extends any[], T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(f1: (...arg: T1) => T2, f2: (arg: T2) => T3, f3: (arg: T3) => T4, f4: (arg: T3) => T5, f5: (arg: T3) => T6, f6: (arg: T3) => T7, f7: (arg: T3) => T8, f8: (arg: T3) => T9, f9: (arg: T3) => T10, f10: (arg: T3) => T11): (...arg: T1) => T11;
332
+ declare function compose<F1Result, F1Args extends any[], F1NextArgs extends any[], LastResult>(f1: (next: (...args: F1NextArgs) => LastResult) => (...args: F1Args) => F1Result, last: (...args: F1NextArgs) => LastResult): (...args: F1Args) => F1Result;
333
+ declare function compose<F1Result, F1Args extends any[], F1NextArgs extends any[], F2Result, F2NextArgs extends any[], LastResult>(f1: (next: (...args: F1NextArgs) => F2Result) => (...args: F1Args) => F1Result, f2: (next: (...args: F2NextArgs) => LastResult) => (...args: F1NextArgs) => F2Result, last: (...args: F2NextArgs) => LastResult): (...args: F1Args) => F1Result;
334
+ declare function compose<F1Result, F1Args extends any[], F1NextArgs extends any[], F2NextArgs extends any[], F2Result, F3NextArgs extends any[], F3Result, LastResult>(f1: (next: (...args: F1NextArgs) => F2Result) => (...args: F1Args) => F1Result, f2: (next: (...args: F2NextArgs) => F3Result) => (...args: F1NextArgs) => F2Result, f3: (next: (...args: F3NextArgs) => LastResult) => (...args: F2NextArgs) => F3Result, last: (...args: F3NextArgs) => LastResult): (...args: F1Args) => F1Result;
335
+ declare function compose<F1Result, F1Args extends any[], F1NextArgs extends any[], F2NextArgs extends any[], F2Result, F3NextArgs extends any[], F3Result, F4NextArgs extends any[], F4Result, LastResult>(f1: (next: (...args: F1NextArgs) => F2Result) => (...args: F1Args) => F1Result, f2: (next: (...args: F2NextArgs) => F3Result) => (...args: F1NextArgs) => F2Result, f3: (next: (...args: F3NextArgs) => F4Result) => (...args: F2NextArgs) => F3Result, f4: (next: (...args: F4NextArgs) => LastResult) => (...args: F3NextArgs) => F4Result, last: (...args: F4NextArgs) => LastResult): (...args: F1Args) => F1Result;
336
+ declare function compose<F1Result, F1Args extends any[], F1NextArgs extends any[], F2NextArgs extends any[], F2Result, F3NextArgs extends any[], F3Result, F4NextArgs extends any[], F4Result, F5NextArgs extends any[], F5Result, LastResult>(f1: (next: (...args: F1NextArgs) => F2Result) => (...args: F1Args) => F1Result, f2: (next: (...args: F2NextArgs) => F3Result) => (...args: F1NextArgs) => F2Result, f3: (next: (...args: F3NextArgs) => F4Result) => (...args: F2NextArgs) => F3Result, f4: (next: (...args: F4NextArgs) => F5Result) => (...args: F3NextArgs) => F4Result, f5: (next: (...args: F5NextArgs) => LastResult) => (...args: F4NextArgs) => F5Result, last: (...args: F5NextArgs) => LastResult): (...args: F1Args) => F1Result;
337
+ declare function compose<F1Result, F1Args extends any[], F1NextArgs extends any[], F2NextArgs extends any[], F2Result, F3NextArgs extends any[], F3Result, F4NextArgs extends any[], F4Result, F5NextArgs extends any[], F5Result, F6NextArgs extends any[], F6Result, LastResult>(f1: (next: (...args: F1NextArgs) => F2Result) => (...args: F1Args) => F1Result, f2: (next: (...args: F2NextArgs) => F3Result) => (...args: F1NextArgs) => F2Result, f3: (next: (...args: F3NextArgs) => F4Result) => (...args: F2NextArgs) => F3Result, f4: (next: (...args: F4NextArgs) => F5Result) => (...args: F3NextArgs) => F4Result, f5: (next: (...args: F5NextArgs) => F6Result) => (...args: F4NextArgs) => F5Result, f6: (next: (...args: F6NextArgs) => LastResult) => (...args: F5NextArgs) => F6Result, last: (...args: F6NextArgs) => LastResult): (...args: F1Args) => F1Result;
338
+ declare function compose<F1Result, F1Args extends any[], F1NextArgs extends any[], F2NextArgs extends any[], F2Result, F3NextArgs extends any[], F3Result, F4NextArgs extends any[], F4Result, F5NextArgs extends any[], F5Result, F6NextArgs extends any[], F6Result, F7NextArgs extends any[], F7Result, LastResult>(f1: (next: (...args: F1NextArgs) => F2Result) => (...args: F1Args) => F1Result, f2: (next: (...args: F2NextArgs) => F3Result) => (...args: F1NextArgs) => F2Result, f3: (next: (...args: F3NextArgs) => F4Result) => (...args: F2NextArgs) => F3Result, f4: (next: (...args: F4NextArgs) => F5Result) => (...args: F3NextArgs) => F4Result, f5: (next: (...args: F5NextArgs) => F6Result) => (...args: F4NextArgs) => F5Result, f6: (next: (...args: F6NextArgs) => F7Result) => (...args: F5NextArgs) => F6Result, f7: (next: (...args: F7NextArgs) => LastResult) => (...args: F6NextArgs) => F7Result, last: (...args: F7NextArgs) => LastResult): (...args: F1Args) => F1Result;
339
+ declare function compose<F1Result, F1Args extends any[], F1NextArgs extends any[], F2NextArgs extends any[], F2Result, F3NextArgs extends any[], F3Result, F4NextArgs extends any[], F4Result, F5NextArgs extends any[], F5Result, F6NextArgs extends any[], F6Result, F7NextArgs extends any[], F7Result, F8NextArgs extends any[], F8Result, LastResult>(f1: (next: (...args: F1NextArgs) => F2Result) => (...args: F1Args) => F1Result, f2: (next: (...args: F2NextArgs) => F3Result) => (...args: F1NextArgs) => F2Result, f3: (next: (...args: F3NextArgs) => F4Result) => (...args: F2NextArgs) => F3Result, f4: (next: (...args: F4NextArgs) => F5Result) => (...args: F3NextArgs) => F4Result, f5: (next: (...args: F5NextArgs) => F6Result) => (...args: F4NextArgs) => F5Result, f6: (next: (...args: F6NextArgs) => F7Result) => (...args: F5NextArgs) => F6Result, f7: (next: (...args: F7NextArgs) => LastResult) => (...args: F6NextArgs) => F7Result, f8: (next: (...args: F8NextArgs) => LastResult) => (...args: F7NextArgs) => F8Result, last: (...args: F8NextArgs) => LastResult): (...args: F1Args) => F1Result;
340
+ declare function compose<F1Result, F1Args extends any[], F1NextArgs extends any[], F2NextArgs extends any[], F2Result, F3NextArgs extends any[], F3Result, F4NextArgs extends any[], F4Result, F5NextArgs extends any[], F5Result, F6NextArgs extends any[], F6Result, F7NextArgs extends any[], F7Result, F8NextArgs extends any[], F8Result, F9NextArgs extends any[], F9Result, LastResult>(f1: (next: (...args: F1NextArgs) => F2Result) => (...args: F1Args) => F1Result, f2: (next: (...args: F2NextArgs) => F3Result) => (...args: F1NextArgs) => F2Result, f3: (next: (...args: F3NextArgs) => F4Result) => (...args: F2NextArgs) => F3Result, f4: (next: (...args: F4NextArgs) => F5Result) => (...args: F3NextArgs) => F4Result, f5: (next: (...args: F5NextArgs) => F6Result) => (...args: F4NextArgs) => F5Result, f6: (next: (...args: F6NextArgs) => F7Result) => (...args: F5NextArgs) => F6Result, f7: (next: (...args: F7NextArgs) => LastResult) => (...args: F6NextArgs) => F7Result, f8: (next: (...args: F8NextArgs) => LastResult) => (...args: F7NextArgs) => F8Result, f9: (next: (...args: F9NextArgs) => LastResult) => (...args: F8NextArgs) => F9Result, last: (...args: F9NextArgs) => LastResult): (...args: F1Args) => F1Result;
341
+ /**
342
+ * This type produces the type array of TItems with all the type items
343
+ * in TItemsToRemove removed from the start of the array type.
344
+ *
345
+ * @example
346
+ * ```
347
+ * RemoveItemsInFront<[number, number], [number]> = [number]
348
+ * RemoveItemsInFront<[File, number, string], [File, number]> = [string]
349
+ * ```
350
+ */
351
+ type RemoveItemsInFront<TItems extends any[], TItemsToRemove extends any[]> = TItems extends [...TItemsToRemove, ...infer TRest] ? TRest : TItems;
352
+ declare const partial: <T extends any[], TA extends Partial<T>, R>(fn: (...args: T) => R, ...args: TA) => (...rest: RemoveItemsInFront<T, TA>) => R;
353
+ /**
354
+ * Like partial but for unary functions that accept
355
+ * a single object argument
356
+ */
357
+ declare const partob: <T, K, PartialArgs extends Partial<T>>(fn: (args: T) => K, argobj: PartialArgs) => (restobj: Omit<T, keyof PartialArgs>) => K;
358
+ /**
359
+ * Creates a Proxy object that will dynamically
360
+ * call the handler argument when attributes are
361
+ * accessed
362
+ */
363
+ declare const proxied: <T, K>(handler: (propertyName: T) => K) => Record<string, K>;
364
+ /**
365
+ * Creates a memoized function. The returned function
366
+ * will only execute the source function when no value
367
+ * has previously been computed. If a ttl (milliseconds)
368
+ * is given previously computed values will be checked
369
+ * for expiration before being returned.
370
+ */
371
+ declare const memo: <TArgs extends any[], TResult>(func: (...args: TArgs) => TResult, options?: {
372
+ key?: ((...args: TArgs) => string) | undefined;
373
+ ttl?: number | undefined;
374
+ }) => (...args: TArgs) => TResult;
375
+ type DebounceFunction<TArgs extends any[]> = {
376
+ (...args: TArgs): void;
377
+ /**
378
+ * Cancels the debounced function
379
+ */
380
+ cancel(): void;
381
+ /**
382
+ * Checks if there is any invocation debounced
383
+ */
384
+ isPending(): boolean;
385
+ /**
386
+ * Runs the debounced function immediately
387
+ */
388
+ flush(...args: TArgs): void;
389
+ };
390
+ type ThrottledFunction<TArgs extends any[]> = {
391
+ (...args: TArgs): void;
392
+ /**
393
+ * Checks if there is any invocation throttled
394
+ */
395
+ isThrottled(): boolean;
396
+ };
397
+ /**
398
+ * Given a delay and a function returns a new function
399
+ * that will only call the source function after delay
400
+ * milliseconds have passed without any invocations.
401
+ *
402
+ * The debounce function comes with a `cancel` method
403
+ * to cancel delayed `func` invocations and a `flush`
404
+ * method to invoke them immediately
405
+ */
406
+ declare const debounce: <TArgs extends any[]>({ delay }: {
407
+ delay: number;
408
+ }, func: (...args: TArgs) => any) => DebounceFunction<TArgs>;
409
+ /**
410
+ * Given an interval and a function returns a new function
411
+ * that will only call the source function if interval milliseconds
412
+ * have passed since the last invocation
413
+ */
414
+ declare const throttle: <TArgs extends any[]>({ interval }: {
415
+ interval: number;
416
+ }, func: (...args: TArgs) => any) => ThrottledFunction<TArgs>;
417
+ /**
418
+ * Make an object callable. Given an object and a function
419
+ * the returned object will be a function with all the
420
+ * objects properties.
421
+ *
422
+ * @example
423
+ * ```typescript
424
+ * const car = callable({
425
+ * wheels: 2
426
+ * }, self => () => {
427
+ * return 'driving'
428
+ * })
429
+ *
430
+ * car.wheels // => 2
431
+ * car() // => 'driving'
432
+ * ```
433
+ */
434
+ declare const callable: <TValue, TObj extends Record<string | number | symbol, TValue>, TFunc extends (...args: any) => any>(obj: TObj, fn: (self: TObj) => TFunc) => TObj & TFunc;
435
+
436
+ /**
437
+ * Checks if the given number is between zero (0) and the ending number. 0 is inclusive.
438
+ *
439
+ * * Numbers can be negative or positive.
440
+ * * Ending number is exclusive.
441
+ *
442
+ * @param {number} number The number to check.
443
+ * @param {number} end The end of the range. Exclusive.
444
+ * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
445
+ */
446
+ declare function inRange(number: number, end: number): boolean;
447
+ /**
448
+ * Checks if the given number is between two numbers.
449
+ *
450
+ * * Numbers can be negative or positive.
451
+ * * Starting number is inclusive.
452
+ * * Ending number is exclusive.
453
+ * * The start and the end of the range can be ascending OR descending order.
454
+ *
455
+ * @param {number} number The number to check.
456
+ * @param {number} start The start of the range. Inclusive.
457
+ * @param {number} end The end of the range. Exclusive.
458
+ * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
459
+ */
460
+ declare function inRange(number: number, start: number, end: number): boolean;
461
+ declare const toFloat: <T extends number | null = number>(value: any, defaultValue?: T | undefined) => number | T;
462
+ declare const toInt: <T extends number | null = number>(value: any, defaultValue?: T | undefined) => number | T;
463
+
464
+ type LowercasedKeys<T extends Record<string, any>> = {
465
+ [P in keyof T & string as Lowercase<P>]: T[P];
466
+ };
467
+ type UppercasedKeys<T extends Record<string, any>> = {
468
+ [P in keyof T & string as Uppercase<P>]: T[P];
469
+ };
470
+ /**
471
+ * Removes (shakes out) undefined entries from an
472
+ * object. Optional second argument shakes out values
473
+ * by custom evaluation.
474
+ */
475
+ declare const shake: <RemovedKeys extends string, T>(obj: T, filter?: (value: any) => boolean) => Omit<T, RemovedKeys>;
476
+ /**
477
+ * Map over all the keys of an object to return
478
+ * a new object
479
+ */
480
+ declare const mapKeys: <TValue, TKey extends string | number | symbol, TNewKey extends string | number | symbol>(obj: Record<TKey, TValue>, mapFunc: (key: TKey, value: TValue) => TNewKey) => Record<TNewKey, TValue>;
481
+ /**
482
+ * Map over all the keys to create a new object
483
+ */
484
+ declare const mapValues: <TValue, TKey extends string | number | symbol, TNewValue>(obj: Record<TKey, TValue>, mapFunc: (value: TValue, key: TKey) => TNewValue) => Record<TKey, TNewValue>;
485
+ /**
486
+ * Map over all the keys to create a new object
487
+ */
488
+ declare const mapEntries: <TKey extends string | number | symbol, TValue, TNewKey extends string | number | symbol, TNewValue>(obj: Record<TKey, TValue>, toEntry: (key: TKey, value: TValue) => [TNewKey, TNewValue]) => Record<TNewKey, TNewValue>;
489
+ /**
490
+ * Returns an object with { [keys]: value }
491
+ * inverted as { [value]: key }
492
+ */
493
+ declare const invert: <TKey extends string | number | symbol, TValue extends string | number | symbol>(obj: Record<TKey, TValue>) => Record<TValue, TKey>;
494
+ /**
495
+ * Convert all keys in an object to lower case
496
+ */
497
+ declare const lowerize: <T extends Record<string, any>>(obj: T) => LowercasedKeys<T>;
498
+ /**
499
+ * Convert all keys in an object to upper case
500
+ */
501
+ declare const upperize: <T extends Record<string, any>>(obj: T) => UppercasedKeys<T>;
502
+ /**
503
+ * Creates a shallow copy of the given obejct/value.
504
+ * @param {*} obj value to clone
505
+ * @returns {*} shallow clone of the given value
506
+ */
507
+ declare const clone: <T>(obj: T) => T;
508
+ /**
509
+ * Convert an object to a list, mapping each entry
510
+ * into a list item
511
+ */
512
+ declare const listify: <TValue, TKey extends string | number | symbol, KResult>(obj: Record<TKey, TValue>, toItem: (key: TKey, value: TValue) => KResult) => KResult[];
513
+ /**
514
+ * Pick a list of properties from an object
515
+ * into a new object
516
+ */
517
+ declare const pick: <T extends object, TKeys extends keyof T>(obj: T, keys: TKeys[]) => Pick<T, TKeys>;
518
+ /**
519
+ * Omit a list of properties from an object
520
+ * returning a new object with the properties
521
+ * that remain
522
+ */
523
+ declare const omit: <T, TKeys extends keyof T>(obj: T, keys: TKeys[]) => Omit<T, TKeys>;
524
+ /**
525
+ * Opposite of get, dynamically set a nested value into
526
+ * an object using a key path. Does not modify the given
527
+ * initial object.
528
+ *
529
+ * @example
530
+ * set({}, 'name', 'ra') // => { name: 'ra' }
531
+ * set({}, 'cards[0].value', 2) // => { cards: [{ value: 2 }] }
532
+ */
533
+ declare const set: <T extends object, K>(initial: T, path: string, value: K) => T;
534
+ /**
535
+ * Merges two objects together recursivly into a new
536
+ * object applying values from right to left.
537
+ * Recursion only applies to child object properties.
538
+ */
539
+ declare const assign: <X extends Record<string | number | symbol, any>>(initial: X, override: X) => X;
540
+ /**
541
+ * Get a string list of all key names that exist in
542
+ * an object (deep).
543
+ *
544
+ * @example
545
+ * keys({ name: 'ra' }) // ['name']
546
+ * keys({ name: 'ra', children: [{ name: 'hathor' }] }) // ['name', 'children.0.name']
547
+ */
548
+ declare const keys: <TValue extends object>(value: TValue) => string[];
549
+ /**
550
+ * Flattens a deep object to a single demension, converting
551
+ * the keys to dot notation.
552
+ *
553
+ * @example
554
+ * crush({ name: 'ra', children: [{ name: 'hathor' }] })
555
+ * // { name: 'ra', 'children.0.name': 'hathor' }
556
+ */
557
+ declare const crush: <TValue extends object>(value: TValue) => object;
558
+ /**
559
+ * The opposite of crush, given an object that was
560
+ * crushed into key paths and values will return
561
+ * the original object reconstructed.
562
+ *
563
+ * @example
564
+ * construct({ name: 'ra', 'children.0.name': 'hathor' })
565
+ * // { name: 'ra', children: [{ name: 'hathor' }] }
566
+ */
567
+ declare const construct: <TObject extends object>(obj: TObject) => object;
568
+
569
+ /**
570
+ * Generates a random number between min and max
571
+ */
572
+ declare const random: (min: number, max: number) => number;
573
+ /**
574
+ * Draw a random item from a list. Returns
575
+ * null if the list is empty
576
+ */
577
+ declare const draw: <T>(array: readonly T[]) => T | null;
578
+ declare const shuffle: <T>(array: readonly T[]) => T[];
579
+ declare const uid: (length: number, specials?: string) => string;
580
+
581
+ /**
582
+ * Creates a series object around a list of values
583
+ * that should be treated with order.
584
+ */
585
+ declare const series: <T>(items: T[], toKey?: (item: T) => string | symbol) => {
586
+ min: (a: T, b: T) => T;
587
+ max: (a: T, b: T) => T;
588
+ first: () => T;
589
+ last: () => T;
590
+ next: (current: T, defaultValue?: T | undefined) => T;
591
+ previous: (current: T, defaultValue?: T | undefined) => T;
592
+ spin: (current: T, num: number) => T;
593
+ };
594
+
595
+ /**
596
+ * Capitalize the first word of the string
597
+ *
598
+ * capitalize('hello') -> 'Hello'
599
+ * capitalize('va va voom') -> 'Va va voom'
600
+ */
601
+ declare const capitalize: (str: string) => string;
602
+ /**
603
+ * Formats the given string in camel case fashion
604
+ *
605
+ * camel('hello world') -> 'helloWorld'
606
+ * camel('va va-VOOM') -> 'vaVaVoom'
607
+ * camel('helloWorld') -> 'helloWorld'
608
+ */
609
+ declare const camel: (str: string) => string;
610
+ /**
611
+ * Formats the given string in snake case fashion
612
+ *
613
+ * snake('hello world') -> 'hello_world'
614
+ * snake('va va-VOOM') -> 'va_va_voom'
615
+ * snake('helloWord') -> 'hello_world'
616
+ */
617
+ declare const snake: (str: string, options?: {
618
+ splitOnNumber?: boolean;
619
+ }) => string;
620
+ /**
621
+ * Formats the given string in dash case fashion
622
+ *
623
+ * dash('hello world') -> 'hello-world'
624
+ * dash('va va_VOOM') -> 'va-va-voom'
625
+ * dash('helloWord') -> 'hello-word'
626
+ */
627
+ declare const dash: (str: string) => string;
628
+ /**
629
+ * Formats the given string in pascal case fashion
630
+ *
631
+ * pascal('hello world') -> 'HelloWorld'
632
+ * pascal('va va boom') -> 'VaVaBoom'
633
+ */
634
+ declare const pascal: (str: string) => string;
635
+ /**
636
+ * Formats the given string in title case fashion
637
+ *
638
+ * title('hello world') -> 'Hello World'
639
+ * title('va_va_boom') -> 'Va Va Boom'
640
+ * title('root-hook') -> 'Root Hook'
641
+ * title('queryItems') -> 'Query Items'
642
+ */
643
+ declare const title: (str: string | null | undefined) => string;
644
+ /**
645
+ * template is used to replace data by name in template strings.
646
+ * The default expression looks for {{name}} to identify names.
647
+ *
648
+ * Ex. template('Hello, {{name}}', { name: 'ray' })
649
+ * Ex. template('Hello, <name>', { name: 'ray' }, /<(.+?)>/g)
650
+ */
651
+ declare const template: (str: string, data: Record<string, any>, regex?: RegExp) => string;
652
+ /**
653
+ * Trims all prefix and suffix characters from the given
654
+ * string. Like the builtin trim function but accepts
655
+ * other characters you would like to trim and trims
656
+ * multiple characters.
657
+ *
658
+ * ```typescript
659
+ * trim(' hello ') // => 'hello'
660
+ * trim('__hello__', '_') // => 'hello'
661
+ * trim('/repos/:owner/:repo/', '/') // => 'repos/:owner/:repo'
662
+ * trim('222222__hello__1111111', '12_') // => 'hello'
663
+ * ```
664
+ */
665
+ declare const trim: (str: string | null | undefined, charsToTrim?: string) => string;
666
+
667
+ declare const isSymbol: (value: any) => value is symbol;
668
+ declare const isArray: (arg: any) => arg is any[];
669
+ declare const isObject: (value: any) => value is object;
670
+ /**
671
+ * Checks if the given value is primitive.
672
+ *
673
+ * Primitive Types: number , string , boolean , symbol, bigint, undefined, null
674
+ *
675
+ * @param {*} value value to check
676
+ * @returns {boolean} result
677
+ */
678
+ declare const isPrimitive: (value: any) => boolean;
679
+ declare const isFunction: (value: any) => value is Function;
680
+ declare const isString: (value: any) => value is string;
681
+ declare const isInt: (value: any) => value is number;
682
+ declare const isFloat: (value: any) => value is number;
683
+ declare const isNumber: (value: any) => value is number;
684
+ declare const isDate: (value: any) => value is Date;
685
+ /**
686
+ * This is really a _best guess_ promise checking. You
687
+ * should probably use Promise.resolve(value) to be 100%
688
+ * sure you're handling it correctly.
689
+ */
690
+ declare const isPromise: (value: any) => value is Promise<any>;
691
+ declare const isEmpty: (value: any) => boolean;
692
+ declare const isEqual: <TType>(x: TType, y: TType) => boolean;
693
+
694
+ declare function get<T = any>(value: T, path: string, defaultValue?: T | undefined): T;
695
+ declare function identity<T>(value: T): T;
696
+ declare function isBoolean(value: any): value is boolean;
697
+ declare function isObjectLike(value: any): boolean;
698
+ declare function isNull(value: any): value is null;
699
+ declare function size(value: any): number;
700
+ declare function isNil(value: any): value is null | undefined;
701
+ declare function toString(value: any): string;
702
+ declare function cloneDeep<T>(value: T): T | null;
703
+
704
+ declare function safe_json_parse<T = any>(str?: any, retOnErr?: T | null): T | null;
705
+ declare function safe_json_stringify(obj?: any): string;
706
+ declare function safe_json_parse_arr<T = any>(str?: any, retOnErr?: T[]): T[];
707
+
708
+ type PartialAll<T> = {
709
+ [P in keyof T]?: T[P] extends Array<any> ? Partial<T[P][number]>[] : Partial<T[P]>;
710
+ };
711
+ type PartialSome<T, K extends keyof T> = {
712
+ [P in K]?: T[P];
713
+ } & Pick<T, Exclude<keyof T, K>>;
714
+ type AnyObject<T = any> = {
715
+ [x: string]: T;
716
+ };
717
+
718
+ type TCommonFileType = 'application/vnd.ms-excel' | 'text/csv;charset=utf-8' | 'application/msword';
719
+ declare function getSearchParamsValue(key: string): string | null;
720
+ declare function getSearchParamsAll(url?: URL): AnyObject<string>;
721
+ declare function setSearchParamsValue(key: string, value: string | number): URL;
722
+ declare function setSearchParamsAll(data: AnyObject<string | number>): URL;
723
+ declare function scrollIntoView(symbol: string, finder?: (selectors: string) => Element | null): void;
724
+ declare function base64ToBinary(data: string, type: TCommonFileType): Blob;
725
+ declare function downloadFile(content: string | Blob, filename?: string, type?: TCommonFileType, isBase64?: boolean): void;
726
+ declare function uuid(): string;
727
+ declare function randomHex(): number;
728
+ declare function charToUTF8(char: string): number[];
729
+ declare function charToUnicode(char: string): number;
730
+ declare function unicodeToChar(u: number): string | null;
731
+ declare function unicode_to_UTF8(u: number): number[] | null;
732
+ declare function getFilledArray(n: number): any[];
733
+ declare function copyText(text: string): boolean;
734
+ declare function safeExec<T extends (...args: any) => any>(fn?: T, ...args: Parameters<T>): any;
735
+ declare function safeGetFromFuncOrData(fn: any): any;
736
+ declare function numberLikeCompare(a: number | string | boolean, b: number | string | boolean): boolean;
737
+ declare function warpBase64Type(str: string, type: 'img' | 'pdf'): string;
738
+ declare function safe_number_parse(value: any, defaultValue?: number): number;
739
+ declare function expect_array<T>(value?: T[] | null, default_v?: T[]): T[];
740
+ declare function gen_encoded_char_svg(props: {
741
+ char: string;
742
+ size?: number;
743
+ color?: string;
744
+ }): string;
745
+ declare function base64_to_image(base64img: string): Promise<HTMLImageElement | null>;
746
+ declare function image_to_base64(img_el: HTMLImageElement): string | null;
747
+ declare function filter_obj_to_url_search(obj: Object | any[]): any;
748
+ declare function safe_async_call<T extends (...args: any) => any>(cb: T, ...args: Parameters<T>): Promise<ReturnType<T> | null>;
749
+ declare function cache_fetch<T = any>(key: string, cb: () => Promise<T>): Promise<T>;
750
+ declare function speculate_on_display(value?: any): string;
751
+ declare function getFuckTimeInterval(star_hour?: number, end_hour?: number, min_interval?: 1 | 2 | 3 | 4 | 5 | 6 | 10 | 15 | 20 | 30): string[];
752
+ declare function random_word(): string[];
753
+ declare function confirm_operation(): boolean;
754
+ declare function simple_encrypt(data: AnyObject | any[]): number[] | null;
755
+ declare function simple_decrypt(code: number[]): AnyObject | null;
756
+ declare function simple_encrypt_str(data: string): string | null;
757
+ declare function simple_decrypt_str(code: string): string | null;
758
+
759
+ interface ILL {
760
+ log?(...optionalParams: any[]): void;
761
+ warn?(...optionalParams: any[]): void;
762
+ error?(...optionalParams: any[]): void;
763
+ }
764
+ declare class MyLog {
765
+ private _logMsg;
766
+ logBig(t: string): void;
767
+ private env;
768
+ private static _handler;
769
+ static set handler(v: ILL);
770
+ constructor(e: string);
771
+ log(...msg: any[]): void;
772
+ warn(...msg: any[]): void;
773
+ error(...msg: any[]): void;
774
+ }
775
+
776
+ declare class EventEmitter<TypeMapInterface extends {
777
+ [x: string]: any[];
778
+ }> {
779
+ events: {
780
+ [x in keyof TypeMapInterface]?: Array<(...args: TypeMapInterface[x]) => void>;
781
+ };
782
+ constructor();
783
+ addListener<T extends keyof TypeMapInterface>(event: T, listener: (...args: TypeMapInterface[T]) => void): this;
784
+ on<T extends keyof TypeMapInterface>(event: T, listener: (...args: TypeMapInterface[T]) => void): this;
785
+ on_cb<T extends keyof TypeMapInterface>(event: T, listener: (...args: TypeMapInterface[T]) => void): (...args: TypeMapInterface[T]) => void;
786
+ on_rm<T extends keyof TypeMapInterface>(event: T, listener: (...args: TypeMapInterface[T]) => void): () => void;
787
+ static logger: MyLog;
788
+ emit<T extends keyof TypeMapInterface>(event: T, ...args: TypeMapInterface[T]): boolean;
789
+ removeAllListeners<T extends keyof TypeMapInterface>(event: T): this;
790
+ off<T extends keyof TypeMapInterface>(event: T, listener: (...args: TypeMapInterface[T]) => void): this;
791
+ once<T extends keyof TypeMapInterface>(event: T, listener: (...args: TypeMapInterface[T]) => void): this;
792
+ prependListener<T extends keyof TypeMapInterface>(event: keyof TypeMapInterface, listener: (...args: any[]) => void): this;
793
+ prependOnceListener<T extends keyof TypeMapInterface>(event: keyof TypeMapInterface, listener: (...args: any[]) => void): this;
794
+ removeListener<T extends keyof TypeMapInterface>(event: keyof TypeMapInterface, listener: (...args: any[]) => void): this;
795
+ setMaxListeners(n: number): this;
796
+ getMaxListeners(): number;
797
+ listeners<T extends keyof TypeMapInterface>(event: keyof TypeMapInterface): Function[];
798
+ rawListeners<T extends keyof TypeMapInterface>(event: keyof TypeMapInterface): Function[];
799
+ eventNames(): Array<keyof TypeMapInterface>;
800
+ listenerCount(type: string): number;
801
+ }
802
+
803
+ declare const EMPTY_PLACEHOLDER = "-";
804
+ declare const TOKEN_KEY = "\u03A3(\u3063 \u00B0\u0414 \u00B0;)\u3063";
805
+ declare const ARG_URS1_KEY = "usr1";
806
+ declare const ARG_URS2_KEY = "usr2";
807
+ declare const noop: () => void;
808
+ declare const ROMAN_NUMERALS: {
809
+ 1: string;
810
+ 2: string;
811
+ 3: string;
812
+ 4: string;
813
+ 5: string;
814
+ 6: string;
815
+ 7: string;
816
+ 8: string;
817
+ 9: string;
818
+ 10: string;
819
+ };
820
+
821
+ type Dayjs = dayjs.Dayjs;
822
+ type DayjsConfigType = dayjs.ConfigType;
823
+ declare function getMomentObj(s: DayjsConfigType): Dayjs;
824
+ declare const formatDate: ((s?: any) => string | null) & {
825
+ format: "YYYY-MM-DD";
826
+ };
827
+ declare const formatDateTime: ((s?: any) => string | null) & {
828
+ format: "YYYY-MM-DD HH:mm:ss";
829
+ };
830
+ declare const formatDateTimeNoSecond: ((s?: any) => string | null) & {
831
+ format: "YYYY-MM-DD HH:mm";
832
+ };
833
+ declare const formatTime: ((s?: any) => string | null) & {
834
+ format: "HH:mm:ss";
835
+ };
836
+ declare function getMomentRange(m?: any): {
837
+ 昨天: [dayjs.Dayjs, dayjs.Dayjs];
838
+ 今天: [dayjs.Dayjs, dayjs.Dayjs];
839
+ 明天: [dayjs.Dayjs, dayjs.Dayjs];
840
+ 上周: [dayjs.Dayjs, dayjs.Dayjs];
841
+ 近一周: [dayjs.Dayjs, dayjs.Dayjs];
842
+ 下周: [dayjs.Dayjs, dayjs.Dayjs];
843
+ 上月: [dayjs.Dayjs, dayjs.Dayjs];
844
+ 近一月: [dayjs.Dayjs, dayjs.Dayjs];
845
+ 下月: [dayjs.Dayjs, dayjs.Dayjs];
846
+ 近一年: [dayjs.Dayjs, dayjs.Dayjs];
847
+ };
848
+ declare function presets_date(): {
849
+ label: string;
850
+ value: any;
851
+ }[];
852
+ declare function isMoment(m: any): boolean;
853
+ /**
854
+ * 获取若干天后的日期
855
+ */
856
+ declare function getFutureDate(num: number): any;
857
+ declare function dayjs_quarter(input: Dayjs, which_quarter?: number): [Dayjs, number];
858
+ declare function diff_between(a: ConfigType, b: ConfigType, unit: QUnitType | OpUnitType, float?: boolean): any;
859
+
860
+ interface ISpectialOption {
861
+ sp?: ICommonOption[];
862
+ start?: number;
863
+ useString?: boolean;
864
+ useDefault?: boolean;
865
+ }
866
+ declare const optionKey其他 = 99;
867
+ declare const optionKey不详 = 100;
868
+ declare const optionKey否 = 0;
869
+ type TOptionKey = string[] | string;
870
+ type TGetOptionKey = () => TOptionKey;
871
+ type TOptions<T extends TOptionKey | TGetOptionKey> = T extends TOptionKey ? ICommonOption[] : () => ICommonOption[];
872
+ declare function getSimpleOptions<T extends TOptionKey | TGetOptionKey>(_arr: T, options?: ISpectialOption): TOptions<T>;
873
+ declare function getSameOptions<T extends TOptionKey | TGetOptionKey>(_arr: T): TOptions<T>;
874
+ declare function getDualModeOptions<T extends TOptionKey | TGetOptionKey>(arr: T, options?: ISpectialOption): readonly [TOptions<T>, TOptions<T>];
875
+ type T_FETCH_OPTIONS = () => (Promise<ICommonOption[]> | ICommonOption[]);
876
+ declare function safe_fetch_options(cb: T_FETCH_OPTIONS): Promise<ICommonOption[]>;
877
+ declare function getPresetOptions(key: string, pure?: boolean): ICommonOption[];
878
+ declare function getOptionLabel(k: string, value: any, defaultLabel?: string): string;
879
+ declare function getOptionValue(k: string, label: any): any;
880
+ declare function merge_preset_options(ops: AnyObject<() => ICommonOption[]>): void;
881
+
882
+ interface IDictionary {
883
+ id: number;
884
+ module: string;
885
+ type: number;
886
+ key: string;
887
+ name: string;
888
+ note: string;
889
+ enumerations: Partial<IEnumeration>[];
890
+ }
891
+ interface IEnumeration {
892
+ id: number;
893
+ label: string;
894
+ note: string;
895
+ value: number;
896
+ }
897
+ declare function getDictionaries(): AnyObject<IDictionary>;
898
+ /**
899
+ *
900
+ * @param value 枚举值value
901
+ * @param type string 字典类型
902
+ */
903
+ declare function getDictionariesEnumerations(type: string): Partial<IEnumeration>[];
904
+ /**
905
+ *
906
+ * @param value 枚举值value
907
+ * @param type string 字典类型
908
+ */
909
+ declare function getDictionaryLabel(type: string, value: string | number): string | null | undefined;
910
+ /**
911
+ *
912
+ * @param label 枚举值value
913
+ * @param type string 字典类型
914
+ */
915
+ declare function getDictionaryValue(type: string, label: string): number | null | undefined;
916
+ declare function merge_dict(ops: AnyObject<IDictionary>): void;
917
+
918
+ export { ARG_URS1_KEY, ARG_URS2_KEY, AggregateError, EMPTY_PLACEHOLDER, EventEmitter, MyLog, ROMAN_NUMERALS, TOKEN_KEY, all, alphabetical, assign, base64ToBinary, base64_to_image, boil, cache_fetch, callable, camel, capitalize, chain, charToUTF8, charToUnicode, clone, cloneDeep, cluster, compose, confirm_operation, construct, copyText, counting, crush, dash, dayjs_quarter, debounce, defer, diff, diff_between, downloadFile, draw, expect_array, filter_obj_to_url_search, first, flat, fork, formatDate, formatDateTime, formatDateTimeNoSecond, formatTime, gen_encoded_char_svg, get, getDictionaries, getDictionariesEnumerations, getDictionaryLabel, getDictionaryValue, getDualModeOptions, getFilledArray, getFuckTimeInterval, getFutureDate, getMomentObj, getMomentRange, getOptionLabel, getOptionValue, getPresetOptions, getSameOptions, getSearchParamsAll, getSearchParamsValue, getSimpleOptions, group, guard, identity, image_to_base64, inRange, intersects, invert, isArray, isBoolean, isDate, isEmpty, isEqual, isFloat, isFunction, isInt, isMoment, isNil, isNull, isNumber, isObject, isObjectLike, isPrimitive, isPromise, isString, isSymbol, iterate, keys, last, list, listify, lowerize, map, mapEntries, mapKeys, mapValues, max, memo, merge, merge_dict, merge_preset_options, min, noop, numberLikeCompare, objectify, omit, optionKey不详, optionKey其他, optionKey否, parallel, partial, partob, pascal, pick, presets_date, proxied, random, randomHex, random_word, range, reduce, replace, replaceOrAppend, retry, safeExec, safeGetFromFuncOrData, safe_async_call, safe_fetch_options, safe_json_parse, safe_json_parse_arr, safe_json_stringify, safe_number_parse, scrollIntoView, select, series, set, setSearchParamsAll, setSearchParamsValue, shake, shift, shuffle, sift, simple_decrypt, simple_decrypt_str, simple_encrypt, simple_encrypt_str, size, sleep, snake, sort, speculate_on_display, sum, template, throttle, title, toFloat, toInt, toString, toggle, trim, tryit as try, tryit, uid, unicodeToChar, unicode_to_UTF8, unique, upperize, uuid, warpBase64Type, zip, zipToObject };
919
+ export type { AnyObject, Dayjs, DayjsConfigType, ICommonOption, PartialAll, PartialSome, TCommonFileType, T_FETCH_OPTIONS };