@noah-libjs/utils 0.0.9 → 0.0.23

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