@ls-stack/utils 3.39.0 → 3.41.0
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/arrayUtils.d.cts +70 -57
- package/dist/arrayUtils.d.ts +70 -57
- package/dist/assertions.d.cts +128 -117
- package/dist/assertions.d.ts +128 -117
- package/dist/asyncQueue.cjs +117 -112
- package/dist/asyncQueue.d.cts +217 -215
- package/dist/asyncQueue.d.ts +217 -215
- package/dist/asyncQueue.js +117 -112
- package/dist/awaitDebounce.d.cts +26 -23
- package/dist/awaitDebounce.d.ts +26 -23
- package/dist/cache.cjs +2 -1
- package/dist/cache.d.cts +15 -9
- package/dist/cache.d.ts +15 -9
- package/dist/cache.js +2 -1
- package/dist/{chunk-GHAQOUA6.js → chunk-23KPGKDT.js} +22 -1
- package/dist/{chunk-ADM37GSC.js → chunk-7L4KCZJJ.js} +12 -10
- package/dist/{chunk-KW55OTUG.js → chunk-B3KFV2MH.js} +2 -2
- package/dist/chunk-DTE2QMWE.js +48 -0
- package/dist/concurrentCalls.d.cts +8 -4
- package/dist/concurrentCalls.d.ts +8 -4
- package/dist/concurrentCalls.js +1 -1
- package/dist/consoleFmt.cjs +1 -0
- package/dist/consoleFmt.d.cts +6 -0
- package/dist/consoleFmt.d.ts +6 -0
- package/dist/consoleFmt.js +1 -0
- package/dist/debounce.d.cts +12 -20
- package/dist/debounce.d.ts +12 -20
- package/dist/dedent.d.cts +31 -31
- package/dist/dedent.d.ts +31 -31
- package/dist/deepEqual.d.cts +10 -9
- package/dist/deepEqual.d.ts +10 -9
- package/dist/filterObjectOrArrayKeys.d.cts +44 -19
- package/dist/filterObjectOrArrayKeys.d.ts +44 -19
- package/dist/getAutoIncrementId.d.cts +25 -23
- package/dist/getAutoIncrementId.d.ts +25 -23
- package/dist/getCompositeKey.d.cts +2 -1
- package/dist/getCompositeKey.d.ts +2 -1
- package/dist/getValueStableKey.d.cts +4 -3
- package/dist/getValueStableKey.d.ts +4 -3
- package/dist/mutationUtils.d.cts +2 -2
- package/dist/mutationUtils.d.ts +2 -2
- package/dist/objUtils.cjs +51 -2
- package/dist/objUtils.d.cts +8 -3
- package/dist/objUtils.d.ts +8 -3
- package/dist/objUtils.js +11 -3
- package/dist/parallelAsyncCalls.cjs +2 -1
- package/dist/parallelAsyncCalls.d.cts +5 -4
- package/dist/parallelAsyncCalls.d.ts +5 -4
- package/dist/parallelAsyncCalls.js +2 -1
- package/dist/retryOnError.d.cts +23 -20
- package/dist/retryOnError.d.ts +23 -20
- package/dist/runShellCmd.d.cts +40 -40
- package/dist/runShellCmd.d.ts +40 -40
- package/dist/safeJson.d.cts +6 -2
- package/dist/safeJson.d.ts +6 -2
- package/dist/saferTyping.d.cts +21 -14
- package/dist/saferTyping.d.ts +21 -14
- package/dist/shallowEqual.d.cts +1 -1
- package/dist/shallowEqual.d.ts +1 -1
- package/dist/stringUtils.cjs +2 -2
- package/dist/stringUtils.d.cts +6 -7
- package/dist/stringUtils.d.ts +6 -7
- package/dist/stringUtils.js +1 -1
- package/dist/testUtils.cjs +11 -9
- package/dist/testUtils.d.cts +32 -14
- package/dist/testUtils.d.ts +32 -14
- package/dist/testUtils.js +4 -3
- package/dist/throttle.d.cts +57 -48
- package/dist/throttle.d.ts +57 -48
- package/dist/timers.d.cts +68 -63
- package/dist/timers.d.ts +68 -63
- package/dist/tsResult.d.cts +7 -6
- package/dist/tsResult.d.ts +7 -6
- package/dist/typeGuards.d.cts +65 -64
- package/dist/typeGuards.d.ts +65 -64
- package/dist/typeUtils.d.cts +18 -4
- package/dist/typeUtils.d.ts +18 -4
- package/dist/typedStrings.d.cts +68 -57
- package/dist/typedStrings.d.ts +68 -57
- package/dist/typingFnUtils.d.cts +12 -6
- package/dist/typingFnUtils.d.ts +12 -6
- package/dist/typingFnUtils.js +12 -35
- package/dist/typingTestUtils.cjs +7 -1
- package/dist/typingTestUtils.d.cts +52 -11
- package/dist/typingTestUtils.d.ts +52 -11
- package/dist/typingTestUtils.js +7 -1
- package/dist/typingUtils.d.cts +4 -1
- package/dist/typingUtils.d.ts +4 -1
- package/dist/yamlStringify.cjs +11 -9
- package/dist/yamlStringify.js +2 -2
- package/package.json +6 -2
- package/docs/README.md +0 -72
- package/docs/_media/modules.md +0 -58
- package/docs/arrayUtils/-internal-.md +0 -179
- package/docs/arrayUtils/README.md +0 -550
- package/docs/assertions/-internal-.md +0 -63
- package/docs/assertions/README.md +0 -565
- package/docs/asyncQueue/-internal-.md +0 -297
- package/docs/asyncQueue/README.md +0 -1485
- package/docs/awaitDebounce.md +0 -66
- package/docs/cache/-internal-.md +0 -168
- package/docs/cache/README.md +0 -360
- package/docs/castValues.md +0 -47
- package/docs/concurrentCalls/-internal-.md +0 -490
- package/docs/concurrentCalls/README.md +0 -299
- package/docs/consoleFmt.md +0 -91
- package/docs/conversions.md +0 -27
- package/docs/createThrottleController/-internal-.md +0 -73
- package/docs/createThrottleController/README.md +0 -31
- package/docs/debounce.md +0 -188
- package/docs/dedent/-internal-.md +0 -17
- package/docs/dedent/README.md +0 -204
- package/docs/deepEqual.md +0 -94
- package/docs/enhancedMap.md +0 -358
- package/docs/exhaustiveMatch/-internal-.md +0 -39
- package/docs/exhaustiveMatch/README.md +0 -146
- package/docs/filterObjectOrArrayKeys.md +0 -109
- package/docs/getAutoIncrementId.md +0 -93
- package/docs/getCompositeKey.md +0 -39
- package/docs/getValueStableKey.md +0 -57
- package/docs/hash.md +0 -31
- package/docs/interpolate/-internal-.md +0 -61
- package/docs/interpolate/README.md +0 -62
- package/docs/keepPrevIfUnchanged.md +0 -43
- package/docs/levenshtein.md +0 -93
- package/docs/main.md +0 -21
- package/docs/mathUtils.md +0 -137
- package/docs/modules.md +0 -58
- package/docs/mutationUtils.md +0 -44
- package/docs/objUtils.md +0 -237
- package/docs/parallelAsyncCalls/-internal-.md +0 -347
- package/docs/parallelAsyncCalls/README.md +0 -45
- package/docs/promiseUtils/-internal-.md +0 -69
- package/docs/promiseUtils/README.md +0 -31
- package/docs/retryOnError/-internal-.md +0 -111
- package/docs/retryOnError/README.md +0 -168
- package/docs/runShellCmd/-internal-.md +0 -111
- package/docs/runShellCmd/README.md +0 -201
- package/docs/safeJson.md +0 -51
- package/docs/saferTyping.md +0 -228
- package/docs/serializeXML.md +0 -100
- package/docs/shallowEqual.md +0 -33
- package/docs/sleep.md +0 -27
- package/docs/stringUtils/-internal-.md +0 -17
- package/docs/stringUtils/README.md +0 -270
- package/docs/testUtils.md +0 -382
- package/docs/throttle/-internal-.md +0 -47
- package/docs/throttle/README.md +0 -178
- package/docs/time.md +0 -274
- package/docs/timers.md +0 -256
- package/docs/tsResult/-internal-.md +0 -327
- package/docs/tsResult/README.md +0 -702
- package/docs/typeGuards.md +0 -399
- package/docs/typeUtils/-internal-.md +0 -99
- package/docs/typeUtils/README.md +0 -195
- package/docs/typeUtils.typesTest.md +0 -7
- package/docs/typedStrings.md +0 -458
- package/docs/typingFnUtils/-internal-.md +0 -43
- package/docs/typingFnUtils/README.md +0 -317
- package/docs/typingTestUtils.md +0 -172
- package/docs/typingUtils.md +0 -135
- package/docs/yamlStringify.md +0 -83
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-IATIXMCE.js";
|
|
4
4
|
import {
|
|
5
5
|
truncateString
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-B3KFV2MH.js";
|
|
7
7
|
import {
|
|
8
8
|
isObject,
|
|
9
9
|
isPlainObject
|
|
@@ -34,14 +34,12 @@ function stringifyValue(value, indent, maxLineLength, showUndefined, maxDepth, d
|
|
|
34
34
|
const entries = Object.entries(value).filter(
|
|
35
35
|
([, val]) => val !== void 0 || showUndefined
|
|
36
36
|
);
|
|
37
|
-
const isSimpleObject = entries.every(
|
|
38
|
-
(
|
|
39
|
-
|
|
40
|
-
return !val.includes("'") && !val.includes('"') && !val.includes("\\");
|
|
41
|
-
}
|
|
42
|
-
return typeof val === "number" || typeof val === "boolean" || val === null || val === void 0;
|
|
37
|
+
const isSimpleObject = entries.every(([, val]) => {
|
|
38
|
+
if (typeof val === "string") {
|
|
39
|
+
return !val.includes("'") && !val.includes('"') && !val.includes("\\");
|
|
43
40
|
}
|
|
44
|
-
|
|
41
|
+
return typeof val === "number" || typeof val === "boolean" || val === null || val === void 0;
|
|
42
|
+
});
|
|
45
43
|
const shouldCollapse = isArrayItem ? entries.length > 1 : entries.length > 0;
|
|
46
44
|
if (isSimpleObject && shouldCollapse) {
|
|
47
45
|
let line = "{ ";
|
|
@@ -94,7 +92,9 @@ function stringifyValue(value, indent, maxLineLength, showUndefined, maxDepth, d
|
|
|
94
92
|
false
|
|
95
93
|
);
|
|
96
94
|
const willBeCollapsed = isObject(objVal) && (Object.keys(objVal).length === 0 || collapseObjects && depth + 1 > 0 && (() => {
|
|
97
|
-
const filteredEntries = Object.entries(objVal).filter(
|
|
95
|
+
const filteredEntries = Object.entries(objVal).filter(
|
|
96
|
+
([, val]) => val !== void 0 || showUndefined
|
|
97
|
+
);
|
|
98
98
|
const shouldCollapseThis = isArrayItem ? filteredEntries.length > 1 : filteredEntries.length > 0;
|
|
99
99
|
return shouldCollapseThis && filteredEntries.every(([, val]) => {
|
|
100
100
|
if (typeof val === "string") {
|
|
@@ -104,7 +104,9 @@ function stringifyValue(value, indent, maxLineLength, showUndefined, maxDepth, d
|
|
|
104
104
|
});
|
|
105
105
|
})());
|
|
106
106
|
const prevWasCollapsed = prevValue && isObject(prevValue) && (Object.keys(prevValue).length === 0 || collapseObjects && depth + 1 > 0 && (() => {
|
|
107
|
-
const filteredEntries = Object.entries(prevValue).filter(
|
|
107
|
+
const filteredEntries = Object.entries(prevValue).filter(
|
|
108
|
+
([, val]) => val !== void 0 || showUndefined
|
|
109
|
+
);
|
|
108
110
|
const shouldCollapseThis = isArrayItem ? filteredEntries.length > 1 : filteredEntries.length > 0;
|
|
109
111
|
return shouldCollapseThis && filteredEntries.every(([, val]) => {
|
|
110
112
|
if (typeof val === "string") {
|
|
@@ -33,10 +33,10 @@ function convertToCamelCase(str) {
|
|
|
33
33
|
return pascalCase.charAt(0).toLowerCase() + pascalCase.slice(1);
|
|
34
34
|
}
|
|
35
35
|
function convertToSentenceCase(str) {
|
|
36
|
-
return str.split(/[\s_-]+/).map((word) => word.toLowerCase()).join(" ").replace(/^\w/, (char) => char.toUpperCase());
|
|
36
|
+
return str.replace(/[\s\-.]+/g, " ").replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/([A-Z])([A-Z][a-z])/g, "$1 $2").split(/[\s_-]+/).map((word) => word.toLowerCase()).join(" ").replace(/^\w/, (char) => char.toUpperCase());
|
|
37
37
|
}
|
|
38
38
|
function convertToTitleCase(str) {
|
|
39
|
-
return str.split(/[\s_-]+/).map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join(" ");
|
|
39
|
+
return str.replace(/[\s\-.]+/g, " ").replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/([A-Z])([A-Z][a-z])/g, "$1 $2").split(/[\s_-]+/).map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join(" ");
|
|
40
40
|
}
|
|
41
41
|
function truncateString(str, length, ellipsis = "\u2026") {
|
|
42
42
|
if (str.length <= length) return str;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// src/typingFnUtils.ts
|
|
2
|
+
function asNonPartial(obj) {
|
|
3
|
+
return obj;
|
|
4
|
+
}
|
|
5
|
+
function typedObjectEntries(obj) {
|
|
6
|
+
return Object.entries(obj);
|
|
7
|
+
}
|
|
8
|
+
function typedObjectKeys(obj) {
|
|
9
|
+
return Object.keys(obj);
|
|
10
|
+
}
|
|
11
|
+
function asType(value) {
|
|
12
|
+
return value;
|
|
13
|
+
}
|
|
14
|
+
function narrowStringToUnion(key, union) {
|
|
15
|
+
if (!key) return void 0;
|
|
16
|
+
if (union instanceof Set) {
|
|
17
|
+
return union.has(key) ? key : void 0;
|
|
18
|
+
}
|
|
19
|
+
if (union.includes(key)) {
|
|
20
|
+
return key;
|
|
21
|
+
}
|
|
22
|
+
return void 0;
|
|
23
|
+
}
|
|
24
|
+
function typeOnRightExtendsLeftType() {
|
|
25
|
+
return void 0;
|
|
26
|
+
}
|
|
27
|
+
var isSubTypeOf = typeOnRightExtendsLeftType;
|
|
28
|
+
function isObjKey(key, obj) {
|
|
29
|
+
return typeof key === "string" && key in obj;
|
|
30
|
+
}
|
|
31
|
+
function unionsAreTheSame(_diff) {
|
|
32
|
+
}
|
|
33
|
+
function asPartialUndefinedValues(value) {
|
|
34
|
+
return value;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export {
|
|
38
|
+
asNonPartial,
|
|
39
|
+
typedObjectEntries,
|
|
40
|
+
typedObjectKeys,
|
|
41
|
+
asType,
|
|
42
|
+
narrowStringToUnion,
|
|
43
|
+
typeOnRightExtendsLeftType,
|
|
44
|
+
isSubTypeOf,
|
|
45
|
+
isObjKey,
|
|
46
|
+
unionsAreTheSame,
|
|
47
|
+
asPartialUndefinedValues
|
|
48
|
+
};
|
|
@@ -58,7 +58,8 @@ declare class ConcurrentCalls<R = unknown, E extends ResultValidErrors = Error>
|
|
|
58
58
|
}>;
|
|
59
59
|
}
|
|
60
60
|
/**
|
|
61
|
-
* Executes multiple asynchronous calls concurrently and collects the results in
|
|
61
|
+
* Executes multiple asynchronous calls concurrently and collects the results in
|
|
62
|
+
* a easier to use format.
|
|
62
63
|
*
|
|
63
64
|
* @template R - The type of the result value.
|
|
64
65
|
*/
|
|
@@ -88,7 +89,8 @@ declare class ConcurrentCallsWithMetadata<M extends ValidMetadata, R = unknown,
|
|
|
88
89
|
}>;
|
|
89
90
|
}
|
|
90
91
|
/**
|
|
91
|
-
* Executes multiple asynchronous calls concurrently with metadata for each call
|
|
92
|
+
* Executes multiple asynchronous calls concurrently with metadata for each call
|
|
93
|
+
* and collects the results in a easier to use format.
|
|
92
94
|
*
|
|
93
95
|
* @template M - The type of the call metadata.
|
|
94
96
|
* @template R - The type of the result value.
|
|
@@ -97,13 +99,15 @@ declare function concurrentCallsWithMetadata<M extends ValidMetadata, R = unknow
|
|
|
97
99
|
type ValueFromResult<R> = R extends Result<infer T, any> ? T : never;
|
|
98
100
|
type ErrorFromResult<R> = R extends Result<any, infer E> ? E : never;
|
|
99
101
|
/**
|
|
100
|
-
* Executes multiple asynchronous result calls concurrently and collects the
|
|
102
|
+
* Executes multiple asynchronous result calls concurrently and collects the
|
|
103
|
+
* results in a easier to use format.
|
|
101
104
|
*
|
|
102
105
|
* @template R - The type of the result function that will be called.
|
|
103
106
|
*/
|
|
104
107
|
declare function concurrentResultCalls<ResultFn extends (...args: any[]) => Promise<Result<unknown, ResultValidErrors>>>(): ConcurrentCalls<ValueFromResult<Awaited<ReturnType<ResultFn>>>, ErrorFromResult<Awaited<ReturnType<ResultFn>>>>;
|
|
105
108
|
/**
|
|
106
|
-
* Executes multiple asynchronous result calls concurrently with metadata for
|
|
109
|
+
* Executes multiple asynchronous result calls concurrently with metadata for
|
|
110
|
+
* each call and collects the results in a easier to use format.
|
|
107
111
|
*
|
|
108
112
|
* @template ResultFn - The type of the result function that will be called.
|
|
109
113
|
*/
|
|
@@ -58,7 +58,8 @@ declare class ConcurrentCalls<R = unknown, E extends ResultValidErrors = Error>
|
|
|
58
58
|
}>;
|
|
59
59
|
}
|
|
60
60
|
/**
|
|
61
|
-
* Executes multiple asynchronous calls concurrently and collects the results in
|
|
61
|
+
* Executes multiple asynchronous calls concurrently and collects the results in
|
|
62
|
+
* a easier to use format.
|
|
62
63
|
*
|
|
63
64
|
* @template R - The type of the result value.
|
|
64
65
|
*/
|
|
@@ -88,7 +89,8 @@ declare class ConcurrentCallsWithMetadata<M extends ValidMetadata, R = unknown,
|
|
|
88
89
|
}>;
|
|
89
90
|
}
|
|
90
91
|
/**
|
|
91
|
-
* Executes multiple asynchronous calls concurrently with metadata for each call
|
|
92
|
+
* Executes multiple asynchronous calls concurrently with metadata for each call
|
|
93
|
+
* and collects the results in a easier to use format.
|
|
92
94
|
*
|
|
93
95
|
* @template M - The type of the call metadata.
|
|
94
96
|
* @template R - The type of the result value.
|
|
@@ -97,13 +99,15 @@ declare function concurrentCallsWithMetadata<M extends ValidMetadata, R = unknow
|
|
|
97
99
|
type ValueFromResult<R> = R extends Result<infer T, any> ? T : never;
|
|
98
100
|
type ErrorFromResult<R> = R extends Result<any, infer E> ? E : never;
|
|
99
101
|
/**
|
|
100
|
-
* Executes multiple asynchronous result calls concurrently and collects the
|
|
102
|
+
* Executes multiple asynchronous result calls concurrently and collects the
|
|
103
|
+
* results in a easier to use format.
|
|
101
104
|
*
|
|
102
105
|
* @template R - The type of the result function that will be called.
|
|
103
106
|
*/
|
|
104
107
|
declare function concurrentResultCalls<ResultFn extends (...args: any[]) => Promise<Result<unknown, ResultValidErrors>>>(): ConcurrentCalls<ValueFromResult<Awaited<ReturnType<ResultFn>>>, ErrorFromResult<Awaited<ReturnType<ResultFn>>>>;
|
|
105
108
|
/**
|
|
106
|
-
* Executes multiple asynchronous result calls concurrently with metadata for
|
|
109
|
+
* Executes multiple asynchronous result calls concurrently with metadata for
|
|
110
|
+
* each call and collects the results in a easier to use format.
|
|
107
111
|
*
|
|
108
112
|
* @template ResultFn - The type of the result function that will be called.
|
|
109
113
|
*/
|
package/dist/concurrentCalls.js
CHANGED
package/dist/consoleFmt.cjs
CHANGED
package/dist/consoleFmt.d.cts
CHANGED
|
@@ -16,8 +16,11 @@ declare const colorToCodeASCII: {
|
|
|
16
16
|
brightCyan: string;
|
|
17
17
|
brightWhite: string;
|
|
18
18
|
};
|
|
19
|
+
/** @deprecated Use `styleText` from `node:util` instead. */
|
|
19
20
|
declare function consoleColors(color: keyof typeof colorToCodeASCII, text: string): string;
|
|
21
|
+
/** @deprecated Use `styleText` from `node:util` instead. */
|
|
20
22
|
declare function bold(text: string): string;
|
|
23
|
+
/** @deprecated Use `styleText` from `node:util` instead. */
|
|
21
24
|
declare function underline(text: string): string;
|
|
22
25
|
declare const bgColorToCodeASCII: {
|
|
23
26
|
red: string;
|
|
@@ -37,8 +40,11 @@ declare const bgColorToCodeASCII: {
|
|
|
37
40
|
brightCyan: string;
|
|
38
41
|
brightWhite: string;
|
|
39
42
|
};
|
|
43
|
+
/** @deprecated Use `styleText` from `node:util` instead. */
|
|
40
44
|
declare function bgColor(color: keyof typeof bgColorToCodeASCII, text: string): string;
|
|
45
|
+
/** @deprecated Use `styleText` from `node:util` instead. */
|
|
41
46
|
declare const consoleFmt: {
|
|
47
|
+
/** @deprecated Use `styleText` from `node:util` instead. */
|
|
42
48
|
color: typeof consoleColors;
|
|
43
49
|
bold: typeof bold;
|
|
44
50
|
underline: typeof underline;
|
package/dist/consoleFmt.d.ts
CHANGED
|
@@ -16,8 +16,11 @@ declare const colorToCodeASCII: {
|
|
|
16
16
|
brightCyan: string;
|
|
17
17
|
brightWhite: string;
|
|
18
18
|
};
|
|
19
|
+
/** @deprecated Use `styleText` from `node:util` instead. */
|
|
19
20
|
declare function consoleColors(color: keyof typeof colorToCodeASCII, text: string): string;
|
|
21
|
+
/** @deprecated Use `styleText` from `node:util` instead. */
|
|
20
22
|
declare function bold(text: string): string;
|
|
23
|
+
/** @deprecated Use `styleText` from `node:util` instead. */
|
|
21
24
|
declare function underline(text: string): string;
|
|
22
25
|
declare const bgColorToCodeASCII: {
|
|
23
26
|
red: string;
|
|
@@ -37,8 +40,11 @@ declare const bgColorToCodeASCII: {
|
|
|
37
40
|
brightCyan: string;
|
|
38
41
|
brightWhite: string;
|
|
39
42
|
};
|
|
43
|
+
/** @deprecated Use `styleText` from `node:util` instead. */
|
|
40
44
|
declare function bgColor(color: keyof typeof bgColorToCodeASCII, text: string): string;
|
|
45
|
+
/** @deprecated Use `styleText` from `node:util` instead. */
|
|
41
46
|
declare const consoleFmt: {
|
|
47
|
+
/** @deprecated Use `styleText` from `node:util` instead. */
|
|
42
48
|
color: typeof consoleColors;
|
|
43
49
|
bold: typeof bold;
|
|
44
50
|
underline: typeof underline;
|
package/dist/consoleFmt.js
CHANGED
package/dist/debounce.d.cts
CHANGED
|
@@ -1,38 +1,30 @@
|
|
|
1
1
|
type DebounceOptions = {
|
|
2
|
-
/**
|
|
3
|
-
* @see _.leading
|
|
4
|
-
*/
|
|
2
|
+
/** @see _.leading */
|
|
5
3
|
leading?: boolean;
|
|
6
|
-
/**
|
|
7
|
-
* @see _.maxWait
|
|
8
|
-
*/
|
|
4
|
+
/** @see _.maxWait */
|
|
9
5
|
maxWait?: number;
|
|
10
|
-
/**
|
|
11
|
-
* @see _.trailing
|
|
12
|
-
*/
|
|
6
|
+
/** @see _.trailing */
|
|
13
7
|
trailing?: boolean;
|
|
14
8
|
};
|
|
15
9
|
interface DebouncedFunc<T extends (...args: any[]) => void> {
|
|
16
10
|
/**
|
|
17
11
|
* Call the original function, but applying the debounce rules.
|
|
18
12
|
*
|
|
19
|
-
* If the debounced function can be run immediately, this calls it and returns
|
|
20
|
-
* value.
|
|
13
|
+
* If the debounced function can be run immediately, this calls it and returns
|
|
14
|
+
* its return value.
|
|
21
15
|
*
|
|
22
|
-
* Otherwise, it returns the return value of the last invocation, or undefined
|
|
23
|
-
* function was not invoked yet.
|
|
16
|
+
* Otherwise, it returns the return value of the last invocation, or undefined
|
|
17
|
+
* if the debounced function was not invoked yet.
|
|
24
18
|
*/
|
|
25
19
|
(...args: Parameters<T>): ReturnType<T> | undefined;
|
|
26
|
-
/**
|
|
27
|
-
* Throw away any pending invocation of the debounced function.
|
|
28
|
-
*/
|
|
20
|
+
/** Throw away any pending invocation of the debounced function. */
|
|
29
21
|
cancel: () => void;
|
|
30
22
|
/**
|
|
31
|
-
* If there is a pending invocation of the debounced function, invoke it
|
|
32
|
-
* its return value.
|
|
23
|
+
* If there is a pending invocation of the debounced function, invoke it
|
|
24
|
+
* immediately and return its return value.
|
|
33
25
|
*
|
|
34
|
-
* Otherwise, return the value from the last invocation, or undefined if the
|
|
35
|
-
* was never invoked.
|
|
26
|
+
* Otherwise, return the value from the last invocation, or undefined if the
|
|
27
|
+
* debounced function was never invoked.
|
|
36
28
|
*/
|
|
37
29
|
flush: () => ReturnType<T> | undefined;
|
|
38
30
|
}
|
package/dist/debounce.d.ts
CHANGED
|
@@ -1,38 +1,30 @@
|
|
|
1
1
|
type DebounceOptions = {
|
|
2
|
-
/**
|
|
3
|
-
* @see _.leading
|
|
4
|
-
*/
|
|
2
|
+
/** @see _.leading */
|
|
5
3
|
leading?: boolean;
|
|
6
|
-
/**
|
|
7
|
-
* @see _.maxWait
|
|
8
|
-
*/
|
|
4
|
+
/** @see _.maxWait */
|
|
9
5
|
maxWait?: number;
|
|
10
|
-
/**
|
|
11
|
-
* @see _.trailing
|
|
12
|
-
*/
|
|
6
|
+
/** @see _.trailing */
|
|
13
7
|
trailing?: boolean;
|
|
14
8
|
};
|
|
15
9
|
interface DebouncedFunc<T extends (...args: any[]) => void> {
|
|
16
10
|
/**
|
|
17
11
|
* Call the original function, but applying the debounce rules.
|
|
18
12
|
*
|
|
19
|
-
* If the debounced function can be run immediately, this calls it and returns
|
|
20
|
-
* value.
|
|
13
|
+
* If the debounced function can be run immediately, this calls it and returns
|
|
14
|
+
* its return value.
|
|
21
15
|
*
|
|
22
|
-
* Otherwise, it returns the return value of the last invocation, or undefined
|
|
23
|
-
* function was not invoked yet.
|
|
16
|
+
* Otherwise, it returns the return value of the last invocation, or undefined
|
|
17
|
+
* if the debounced function was not invoked yet.
|
|
24
18
|
*/
|
|
25
19
|
(...args: Parameters<T>): ReturnType<T> | undefined;
|
|
26
|
-
/**
|
|
27
|
-
* Throw away any pending invocation of the debounced function.
|
|
28
|
-
*/
|
|
20
|
+
/** Throw away any pending invocation of the debounced function. */
|
|
29
21
|
cancel: () => void;
|
|
30
22
|
/**
|
|
31
|
-
* If there is a pending invocation of the debounced function, invoke it
|
|
32
|
-
* its return value.
|
|
23
|
+
* If there is a pending invocation of the debounced function, invoke it
|
|
24
|
+
* immediately and return its return value.
|
|
33
25
|
*
|
|
34
|
-
* Otherwise, return the value from the last invocation, or undefined if the
|
|
35
|
-
* was never invoked.
|
|
26
|
+
* Otherwise, return the value from the last invocation, or undefined if the
|
|
27
|
+
* debounced function was never invoked.
|
|
36
28
|
*/
|
|
37
29
|
flush: () => ReturnType<T> | undefined;
|
|
38
30
|
}
|
package/dist/dedent.d.cts
CHANGED
|
@@ -1,72 +1,72 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Configuration options for the dedent function behavior
|
|
3
|
-
*/
|
|
1
|
+
/** Configuration options for the dedent function behavior */
|
|
4
2
|
interface DedentOptions {
|
|
5
3
|
/**
|
|
6
|
-
* Whether to process escape sequences like \n,
|
|
7
|
-
*
|
|
4
|
+
* Whether to process escape sequences like \n, `, $, and { When true, allows
|
|
5
|
+
* using escaped characters in template literals
|
|
6
|
+
*
|
|
8
7
|
* @default true for template literals, false for plain strings
|
|
9
8
|
*/
|
|
10
9
|
escapeSpecialCharacters?: boolean;
|
|
11
10
|
/**
|
|
12
11
|
* Whether to trim leading and trailing whitespace from the final result
|
|
12
|
+
*
|
|
13
13
|
* @default true
|
|
14
14
|
*/
|
|
15
15
|
trimWhitespace?: boolean;
|
|
16
16
|
/**
|
|
17
17
|
* Whether to preserve relative indentation of interpolated multi-line values
|
|
18
|
-
* When true, multi-line interpolations are re-indented to match the
|
|
18
|
+
* When true, multi-line interpolations are re-indented to match the
|
|
19
|
+
* surrounding context
|
|
20
|
+
*
|
|
19
21
|
* @default true
|
|
20
22
|
*/
|
|
21
23
|
identInterpolations?: boolean;
|
|
22
24
|
/**
|
|
23
|
-
* Whether to display nullish or false values (false, null, undefined) in
|
|
24
|
-
* When false, nullish or false values are skipped entirely
|
|
25
|
+
* Whether to display nullish or false values (false, null, undefined) in
|
|
26
|
+
* interpolations When false, nullish or false values are skipped entirely
|
|
27
|
+
*
|
|
25
28
|
* @default false
|
|
26
29
|
*/
|
|
27
30
|
showNullishOrFalseValues?: boolean;
|
|
28
31
|
}
|
|
29
32
|
type InterpolationValue = string | number | boolean | null | undefined;
|
|
30
33
|
/**
|
|
31
|
-
* Dedent function interface that can be used both as a template tag and a
|
|
34
|
+
* Dedent function interface that can be used both as a template tag and a
|
|
35
|
+
* regular function
|
|
32
36
|
*/
|
|
33
37
|
interface Dedent {
|
|
34
|
-
/**
|
|
35
|
-
* Process a plain string to remove common indentation
|
|
36
|
-
*/
|
|
38
|
+
/** Process a plain string to remove common indentation */
|
|
37
39
|
(literals: string): string;
|
|
38
40
|
/**
|
|
39
|
-
* Process a template literal to remove common indentation while handling
|
|
41
|
+
* Process a template literal to remove common indentation while handling
|
|
42
|
+
* interpolations
|
|
40
43
|
*/
|
|
41
44
|
(strings: TemplateStringsArray, ...values: InterpolationValue[]): string;
|
|
42
|
-
/**
|
|
43
|
-
* Create a new dedent function with custom options
|
|
44
|
-
*/
|
|
45
|
+
/** Create a new dedent function with custom options */
|
|
45
46
|
withOptions: CreateDedent;
|
|
46
47
|
}
|
|
47
|
-
/**
|
|
48
|
-
* Factory function type for creating dedent functions with custom options
|
|
49
|
-
*/
|
|
48
|
+
/** Factory function type for creating dedent functions with custom options */
|
|
50
49
|
type CreateDedent = (options: DedentOptions) => Dedent;
|
|
51
50
|
/**
|
|
52
|
-
* Remove common leading indentation from multi-line strings while preserving
|
|
53
|
-
* Can be used as a tagged template literal or called with
|
|
51
|
+
* Remove common leading indentation from multi-line strings while preserving
|
|
52
|
+
* relative indentation. Can be used as a tagged template literal or called with
|
|
53
|
+
* a plain string.
|
|
54
54
|
*
|
|
55
|
-
* By default, it will dedent interpolated multi-line strings to match the
|
|
56
|
-
* And it will not show falsy values.
|
|
55
|
+
* By default, it will dedent interpolated multi-line strings to match the
|
|
56
|
+
* surrounding context. And it will not show falsy values.
|
|
57
57
|
*
|
|
58
58
|
* @example
|
|
59
|
-
*
|
|
60
|
-
*
|
|
59
|
+
* ```typescript
|
|
60
|
+
* const text = dedent`;
|
|
61
61
|
* function hello() {
|
|
62
62
|
* console.log('world');
|
|
63
63
|
* }
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
64
|
+
* `;
|
|
65
|
+
* // Result:
|
|
66
|
+
* "function hello() {
|
|
67
|
+
* console.log('world');
|
|
68
|
+
* }"
|
|
69
|
+
* ```;
|
|
70
70
|
*/
|
|
71
71
|
declare const dedent: Dedent;
|
|
72
72
|
|
package/dist/dedent.d.ts
CHANGED
|
@@ -1,72 +1,72 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Configuration options for the dedent function behavior
|
|
3
|
-
*/
|
|
1
|
+
/** Configuration options for the dedent function behavior */
|
|
4
2
|
interface DedentOptions {
|
|
5
3
|
/**
|
|
6
|
-
* Whether to process escape sequences like \n,
|
|
7
|
-
*
|
|
4
|
+
* Whether to process escape sequences like \n, `, $, and { When true, allows
|
|
5
|
+
* using escaped characters in template literals
|
|
6
|
+
*
|
|
8
7
|
* @default true for template literals, false for plain strings
|
|
9
8
|
*/
|
|
10
9
|
escapeSpecialCharacters?: boolean;
|
|
11
10
|
/**
|
|
12
11
|
* Whether to trim leading and trailing whitespace from the final result
|
|
12
|
+
*
|
|
13
13
|
* @default true
|
|
14
14
|
*/
|
|
15
15
|
trimWhitespace?: boolean;
|
|
16
16
|
/**
|
|
17
17
|
* Whether to preserve relative indentation of interpolated multi-line values
|
|
18
|
-
* When true, multi-line interpolations are re-indented to match the
|
|
18
|
+
* When true, multi-line interpolations are re-indented to match the
|
|
19
|
+
* surrounding context
|
|
20
|
+
*
|
|
19
21
|
* @default true
|
|
20
22
|
*/
|
|
21
23
|
identInterpolations?: boolean;
|
|
22
24
|
/**
|
|
23
|
-
* Whether to display nullish or false values (false, null, undefined) in
|
|
24
|
-
* When false, nullish or false values are skipped entirely
|
|
25
|
+
* Whether to display nullish or false values (false, null, undefined) in
|
|
26
|
+
* interpolations When false, nullish or false values are skipped entirely
|
|
27
|
+
*
|
|
25
28
|
* @default false
|
|
26
29
|
*/
|
|
27
30
|
showNullishOrFalseValues?: boolean;
|
|
28
31
|
}
|
|
29
32
|
type InterpolationValue = string | number | boolean | null | undefined;
|
|
30
33
|
/**
|
|
31
|
-
* Dedent function interface that can be used both as a template tag and a
|
|
34
|
+
* Dedent function interface that can be used both as a template tag and a
|
|
35
|
+
* regular function
|
|
32
36
|
*/
|
|
33
37
|
interface Dedent {
|
|
34
|
-
/**
|
|
35
|
-
* Process a plain string to remove common indentation
|
|
36
|
-
*/
|
|
38
|
+
/** Process a plain string to remove common indentation */
|
|
37
39
|
(literals: string): string;
|
|
38
40
|
/**
|
|
39
|
-
* Process a template literal to remove common indentation while handling
|
|
41
|
+
* Process a template literal to remove common indentation while handling
|
|
42
|
+
* interpolations
|
|
40
43
|
*/
|
|
41
44
|
(strings: TemplateStringsArray, ...values: InterpolationValue[]): string;
|
|
42
|
-
/**
|
|
43
|
-
* Create a new dedent function with custom options
|
|
44
|
-
*/
|
|
45
|
+
/** Create a new dedent function with custom options */
|
|
45
46
|
withOptions: CreateDedent;
|
|
46
47
|
}
|
|
47
|
-
/**
|
|
48
|
-
* Factory function type for creating dedent functions with custom options
|
|
49
|
-
*/
|
|
48
|
+
/** Factory function type for creating dedent functions with custom options */
|
|
50
49
|
type CreateDedent = (options: DedentOptions) => Dedent;
|
|
51
50
|
/**
|
|
52
|
-
* Remove common leading indentation from multi-line strings while preserving
|
|
53
|
-
* Can be used as a tagged template literal or called with
|
|
51
|
+
* Remove common leading indentation from multi-line strings while preserving
|
|
52
|
+
* relative indentation. Can be used as a tagged template literal or called with
|
|
53
|
+
* a plain string.
|
|
54
54
|
*
|
|
55
|
-
* By default, it will dedent interpolated multi-line strings to match the
|
|
56
|
-
* And it will not show falsy values.
|
|
55
|
+
* By default, it will dedent interpolated multi-line strings to match the
|
|
56
|
+
* surrounding context. And it will not show falsy values.
|
|
57
57
|
*
|
|
58
58
|
* @example
|
|
59
|
-
*
|
|
60
|
-
*
|
|
59
|
+
* ```typescript
|
|
60
|
+
* const text = dedent`;
|
|
61
61
|
* function hello() {
|
|
62
62
|
* console.log('world');
|
|
63
63
|
* }
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
64
|
+
* `;
|
|
65
|
+
* // Result:
|
|
66
|
+
* "function hello() {
|
|
67
|
+
* console.log('world');
|
|
68
|
+
* }"
|
|
69
|
+
* ```;
|
|
70
70
|
*/
|
|
71
71
|
declare const dedent: Dedent;
|
|
72
72
|
|
package/dist/deepEqual.d.cts
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Deep equality comparison between two values
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```ts
|
|
6
|
+
* deepEqual({a: 1}, {a: 1}) // true
|
|
7
|
+
* deepEqual({a: 1}, {a: 2}) // false
|
|
8
|
+
* deepEqual([1, {b: 2}], [1, {b: 2}]) // true
|
|
9
|
+
* deepEqual(new Map([['a', 1]]), new Map([['a', 1]])) // true
|
|
10
|
+
* deepEqual(new Set([1, 2]), new Set([1, 2])) // true
|
|
11
|
+
* ```;
|
|
12
|
+
*
|
|
3
13
|
* @param foo First value to compare
|
|
4
14
|
* @param bar Second value to compare
|
|
5
15
|
* @param maxDepth Maximum comparison depth (default: 20)
|
|
6
16
|
* @returns True if values are deeply equal, false otherwise
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```ts
|
|
10
|
-
* deepEqual({a: 1}, {a: 1}) // true
|
|
11
|
-
* deepEqual({a: 1}, {a: 2}) // false
|
|
12
|
-
* deepEqual([1, {b: 2}], [1, {b: 2}]) // true
|
|
13
|
-
* deepEqual(new Map([['a', 1]]), new Map([['a', 1]])) // true
|
|
14
|
-
* deepEqual(new Set([1, 2]), new Set([1, 2])) // true
|
|
15
|
-
* ```
|
|
16
17
|
*/
|
|
17
18
|
declare function deepEqual(foo: any, bar: any, maxDepth?: number): boolean;
|
|
18
19
|
declare function deepEqualWithMaxDepth(maxDepth: number): (foo: any, bar: any) => boolean;
|
package/dist/deepEqual.d.ts
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Deep equality comparison between two values
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```ts
|
|
6
|
+
* deepEqual({a: 1}, {a: 1}) // true
|
|
7
|
+
* deepEqual({a: 1}, {a: 2}) // false
|
|
8
|
+
* deepEqual([1, {b: 2}], [1, {b: 2}]) // true
|
|
9
|
+
* deepEqual(new Map([['a', 1]]), new Map([['a', 1]])) // true
|
|
10
|
+
* deepEqual(new Set([1, 2]), new Set([1, 2])) // true
|
|
11
|
+
* ```;
|
|
12
|
+
*
|
|
3
13
|
* @param foo First value to compare
|
|
4
14
|
* @param bar Second value to compare
|
|
5
15
|
* @param maxDepth Maximum comparison depth (default: 20)
|
|
6
16
|
* @returns True if values are deeply equal, false otherwise
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```ts
|
|
10
|
-
* deepEqual({a: 1}, {a: 1}) // true
|
|
11
|
-
* deepEqual({a: 1}, {a: 2}) // false
|
|
12
|
-
* deepEqual([1, {b: 2}], [1, {b: 2}]) // true
|
|
13
|
-
* deepEqual(new Map([['a', 1]]), new Map([['a', 1]])) // true
|
|
14
|
-
* deepEqual(new Set([1, 2]), new Set([1, 2])) // true
|
|
15
|
-
* ```
|
|
16
17
|
*/
|
|
17
18
|
declare function deepEqual(foo: any, bar: any, maxDepth?: number): boolean;
|
|
18
19
|
declare function deepEqualWithMaxDepth(maxDepth: number): (foo: any, bar: any) => boolean;
|