@ls-stack/utils 3.33.0 → 3.34.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{lib → dist}/arrayUtils.cjs +5 -0
- package/{lib → dist}/arrayUtils.d.cts +19 -1
- package/{lib → dist}/arrayUtils.d.ts +19 -1
- package/{lib → dist}/arrayUtils.js +3 -1
- package/{lib/chunk-RYBJST64.js → dist/chunk-4DVTWCXL.js} +4 -0
- package/{lib/chunk-IY3KYH32.js → dist/chunk-ADM37GSC.js} +1 -1
- package/{lib/chunk-3LZQMZAS.js → dist/chunk-KW55OTUG.js} +5 -1
- package/{lib/chunk-XUNY3QUT.js → dist/chunk-XPOGWCUC.js} +1 -1
- package/{lib → dist}/concurrentCalls.js +2 -2
- package/{lib → dist}/filterObjectOrArrayKeys.js +2 -2
- package/{lib → dist}/serializeXML.js +1 -1
- package/{lib → dist}/stringUtils.cjs +5 -0
- package/{lib → dist}/stringUtils.d.cts +2 -1
- package/{lib → dist}/stringUtils.d.ts +2 -1
- package/{lib → dist}/stringUtils.js +3 -1
- package/{lib → dist}/testUtils.js +4 -4
- package/{lib → dist}/yamlStringify.js +2 -2
- package/docs/arrayUtils/-internal-.md +4 -4
- package/docs/arrayUtils/README.md +45 -10
- package/docs/stringUtils/README.md +20 -0
- package/package.json +101 -101
- /package/{lib → dist}/assertions.cjs +0 -0
- /package/{lib → dist}/assertions.d.cts +0 -0
- /package/{lib → dist}/assertions.d.ts +0 -0
- /package/{lib → dist}/assertions.js +0 -0
- /package/{lib → dist}/asyncQueue.cjs +0 -0
- /package/{lib → dist}/asyncQueue.d.cts +0 -0
- /package/{lib → dist}/asyncQueue.d.ts +0 -0
- /package/{lib → dist}/asyncQueue.js +0 -0
- /package/{lib → dist}/awaitDebounce.cjs +0 -0
- /package/{lib → dist}/awaitDebounce.d.cts +0 -0
- /package/{lib → dist}/awaitDebounce.d.ts +0 -0
- /package/{lib → dist}/awaitDebounce.js +0 -0
- /package/{lib → dist}/cache.cjs +0 -0
- /package/{lib → dist}/cache.d.cts +0 -0
- /package/{lib → dist}/cache.d.ts +0 -0
- /package/{lib → dist}/cache.js +0 -0
- /package/{lib → dist}/castValues.cjs +0 -0
- /package/{lib → dist}/castValues.d.cts +0 -0
- /package/{lib → dist}/castValues.d.ts +0 -0
- /package/{lib → dist}/castValues.js +0 -0
- /package/{lib → dist}/chunk-5DZT3Z5Z.js +0 -0
- /package/{lib → dist}/chunk-5MNYPLZI.js +0 -0
- /package/{lib → dist}/chunk-6FIBVC2P.js +0 -0
- /package/{lib → dist}/chunk-7CQPOM5I.js +0 -0
- /package/{lib → dist}/chunk-C2SVCIWE.js +0 -0
- /package/{lib → dist}/chunk-DFXNVEH6.js +0 -0
- /package/{lib → dist}/chunk-GHAQOUA6.js +0 -0
- /package/{lib → dist}/chunk-HTCYUMDR.js +0 -0
- /package/{lib → dist}/chunk-IATIXMCE.js +0 -0
- /package/{lib → dist}/chunk-II4R3VVX.js +0 -0
- /package/{lib → dist}/chunk-JF2MDHOJ.js +0 -0
- /package/{lib → dist}/chunk-JQFUKJU5.js +0 -0
- /package/{lib → dist}/chunk-NW5H5EW7.js +0 -0
- /package/{lib → dist}/chunk-VAAMRG4K.js +0 -0
- /package/{lib → dist}/concurrentCalls.cjs +0 -0
- /package/{lib → dist}/concurrentCalls.d.cts +0 -0
- /package/{lib → dist}/concurrentCalls.d.ts +0 -0
- /package/{lib → dist}/consoleFmt.cjs +0 -0
- /package/{lib → dist}/consoleFmt.d.cts +0 -0
- /package/{lib → dist}/consoleFmt.d.ts +0 -0
- /package/{lib → dist}/consoleFmt.js +0 -0
- /package/{lib → dist}/conversions.cjs +0 -0
- /package/{lib → dist}/conversions.d.cts +0 -0
- /package/{lib → dist}/conversions.d.ts +0 -0
- /package/{lib → dist}/conversions.js +0 -0
- /package/{lib → dist}/createThrottleController.cjs +0 -0
- /package/{lib → dist}/createThrottleController.d.cts +0 -0
- /package/{lib → dist}/createThrottleController.d.ts +0 -0
- /package/{lib → dist}/createThrottleController.js +0 -0
- /package/{lib → dist}/debounce.cjs +0 -0
- /package/{lib → dist}/debounce.d.cts +0 -0
- /package/{lib → dist}/debounce.d.ts +0 -0
- /package/{lib → dist}/debounce.js +0 -0
- /package/{lib → dist}/dedent.cjs +0 -0
- /package/{lib → dist}/dedent.d.cts +0 -0
- /package/{lib → dist}/dedent.d.ts +0 -0
- /package/{lib → dist}/dedent.js +0 -0
- /package/{lib → dist}/deepEqual.cjs +0 -0
- /package/{lib → dist}/deepEqual.d.cts +0 -0
- /package/{lib → dist}/deepEqual.d.ts +0 -0
- /package/{lib → dist}/deepEqual.js +0 -0
- /package/{lib → dist}/enhancedMap.cjs +0 -0
- /package/{lib → dist}/enhancedMap.d.cts +0 -0
- /package/{lib → dist}/enhancedMap.d.ts +0 -0
- /package/{lib → dist}/enhancedMap.js +0 -0
- /package/{lib → dist}/exhaustiveMatch.cjs +0 -0
- /package/{lib → dist}/exhaustiveMatch.d.cts +0 -0
- /package/{lib → dist}/exhaustiveMatch.d.ts +0 -0
- /package/{lib → dist}/exhaustiveMatch.js +0 -0
- /package/{lib → dist}/filterObjectOrArrayKeys.cjs +0 -0
- /package/{lib → dist}/filterObjectOrArrayKeys.d.cts +0 -0
- /package/{lib → dist}/filterObjectOrArrayKeys.d.ts +0 -0
- /package/{lib → dist}/getAutoIncrementId.cjs +0 -0
- /package/{lib → dist}/getAutoIncrementId.d.cts +0 -0
- /package/{lib → dist}/getAutoIncrementId.d.ts +0 -0
- /package/{lib → dist}/getAutoIncrementId.js +0 -0
- /package/{lib → dist}/getCompositeKey.cjs +0 -0
- /package/{lib → dist}/getCompositeKey.d.cts +0 -0
- /package/{lib → dist}/getCompositeKey.d.ts +0 -0
- /package/{lib → dist}/getCompositeKey.js +0 -0
- /package/{lib → dist}/getValueStableKey.cjs +0 -0
- /package/{lib → dist}/getValueStableKey.d.cts +0 -0
- /package/{lib → dist}/getValueStableKey.d.ts +0 -0
- /package/{lib → dist}/getValueStableKey.js +0 -0
- /package/{lib → dist}/hash.cjs +0 -0
- /package/{lib → dist}/hash.d.cts +0 -0
- /package/{lib → dist}/hash.d.ts +0 -0
- /package/{lib → dist}/hash.js +0 -0
- /package/{lib → dist}/interpolate.cjs +0 -0
- /package/{lib → dist}/interpolate.d.cts +0 -0
- /package/{lib → dist}/interpolate.d.ts +0 -0
- /package/{lib → dist}/interpolate.js +0 -0
- /package/{lib → dist}/levenshtein.cjs +0 -0
- /package/{lib → dist}/levenshtein.d.cts +0 -0
- /package/{lib → dist}/levenshtein.d.ts +0 -0
- /package/{lib → dist}/levenshtein.js +0 -0
- /package/{lib → dist}/main.cjs +0 -0
- /package/{lib → dist}/main.d.cts +0 -0
- /package/{lib → dist}/main.d.ts +0 -0
- /package/{lib → dist}/main.js +0 -0
- /package/{lib → dist}/mathUtils.cjs +0 -0
- /package/{lib → dist}/mathUtils.d.cts +0 -0
- /package/{lib → dist}/mathUtils.d.ts +0 -0
- /package/{lib → dist}/mathUtils.js +0 -0
- /package/{lib → dist}/objUtils.cjs +0 -0
- /package/{lib → dist}/objUtils.d.cts +0 -0
- /package/{lib → dist}/objUtils.d.ts +0 -0
- /package/{lib → dist}/objUtils.js +0 -0
- /package/{lib → dist}/parallelAsyncCalls.cjs +0 -0
- /package/{lib → dist}/parallelAsyncCalls.d.cts +0 -0
- /package/{lib → dist}/parallelAsyncCalls.d.ts +0 -0
- /package/{lib → dist}/parallelAsyncCalls.js +0 -0
- /package/{lib → dist}/promiseUtils.cjs +0 -0
- /package/{lib → dist}/promiseUtils.d.cts +0 -0
- /package/{lib → dist}/promiseUtils.d.ts +0 -0
- /package/{lib → dist}/promiseUtils.js +0 -0
- /package/{lib → dist}/retryOnError.cjs +0 -0
- /package/{lib → dist}/retryOnError.d.cts +0 -0
- /package/{lib → dist}/retryOnError.d.ts +0 -0
- /package/{lib → dist}/retryOnError.js +0 -0
- /package/{lib → dist}/runShellCmd.cjs +0 -0
- /package/{lib → dist}/runShellCmd.d.cts +0 -0
- /package/{lib → dist}/runShellCmd.d.ts +0 -0
- /package/{lib → dist}/runShellCmd.js +0 -0
- /package/{lib → dist}/safeJson.cjs +0 -0
- /package/{lib → dist}/safeJson.d.cts +0 -0
- /package/{lib → dist}/safeJson.d.ts +0 -0
- /package/{lib → dist}/safeJson.js +0 -0
- /package/{lib → dist}/saferTyping.cjs +0 -0
- /package/{lib → dist}/saferTyping.d.cts +0 -0
- /package/{lib → dist}/saferTyping.d.ts +0 -0
- /package/{lib → dist}/saferTyping.js +0 -0
- /package/{lib → dist}/serializeXML.cjs +0 -0
- /package/{lib → dist}/serializeXML.d.cts +0 -0
- /package/{lib → dist}/serializeXML.d.ts +0 -0
- /package/{lib → dist}/shallowEqual.cjs +0 -0
- /package/{lib → dist}/shallowEqual.d.cts +0 -0
- /package/{lib → dist}/shallowEqual.d.ts +0 -0
- /package/{lib → dist}/shallowEqual.js +0 -0
- /package/{lib → dist}/sleep.cjs +0 -0
- /package/{lib → dist}/sleep.d.cts +0 -0
- /package/{lib → dist}/sleep.d.ts +0 -0
- /package/{lib → dist}/sleep.js +0 -0
- /package/{lib → dist}/testUtils.cjs +0 -0
- /package/{lib → dist}/testUtils.d.cts +0 -0
- /package/{lib → dist}/testUtils.d.ts +0 -0
- /package/{lib → dist}/throttle.cjs +0 -0
- /package/{lib → dist}/throttle.d.cts +0 -0
- /package/{lib → dist}/throttle.d.ts +0 -0
- /package/{lib → dist}/throttle.js +0 -0
- /package/{lib → dist}/time.cjs +0 -0
- /package/{lib → dist}/time.d.cts +0 -0
- /package/{lib → dist}/time.d.ts +0 -0
- /package/{lib → dist}/time.js +0 -0
- /package/{lib → dist}/timers.cjs +0 -0
- /package/{lib → dist}/timers.d.cts +0 -0
- /package/{lib → dist}/timers.d.ts +0 -0
- /package/{lib → dist}/timers.js +0 -0
- /package/{lib → dist}/tsResult.cjs +0 -0
- /package/{lib → dist}/tsResult.d.cts +0 -0
- /package/{lib → dist}/tsResult.d.ts +0 -0
- /package/{lib → dist}/tsResult.js +0 -0
- /package/{lib → dist}/typeGuards.cjs +0 -0
- /package/{lib → dist}/typeGuards.d.cts +0 -0
- /package/{lib → dist}/typeGuards.d.ts +0 -0
- /package/{lib → dist}/typeGuards.js +0 -0
- /package/{lib → dist}/typeUtils.cjs +0 -0
- /package/{lib → dist}/typeUtils.d.cts +0 -0
- /package/{lib → dist}/typeUtils.d.ts +0 -0
- /package/{lib → dist}/typeUtils.js +0 -0
- /package/{lib → dist}/typingFnUtils.cjs +0 -0
- /package/{lib → dist}/typingFnUtils.d.cts +0 -0
- /package/{lib → dist}/typingFnUtils.d.ts +0 -0
- /package/{lib → dist}/typingFnUtils.js +0 -0
- /package/{lib → dist}/typingTestUtils.cjs +0 -0
- /package/{lib → dist}/typingTestUtils.d.cts +0 -0
- /package/{lib → dist}/typingTestUtils.d.ts +0 -0
- /package/{lib → dist}/typingTestUtils.js +0 -0
- /package/{lib → dist}/typingUtils.cjs +0 -0
- /package/{lib → dist}/typingUtils.d.cts +0 -0
- /package/{lib → dist}/typingUtils.d.ts +0 -0
- /package/{lib → dist}/typingUtils.js +0 -0
- /package/{lib → dist}/yamlStringify.cjs +0 -0
- /package/{lib → dist}/yamlStringify.d.cts +0 -0
- /package/{lib → dist}/yamlStringify.d.ts +0 -0
|
@@ -26,6 +26,7 @@ __export(arrayUtils_exports, {
|
|
|
26
26
|
filterAndMap: () => filterAndMap,
|
|
27
27
|
findAfterIndex: () => findAfterIndex,
|
|
28
28
|
findBeforeIndex: () => findBeforeIndex,
|
|
29
|
+
getAscIndexOrder: () => getAscIndexOrder,
|
|
29
30
|
hasDuplicates: () => hasDuplicates,
|
|
30
31
|
isInArray: () => isInArray,
|
|
31
32
|
rejectArrayUndefinedValues: () => rejectArrayUndefinedValues,
|
|
@@ -80,6 +81,9 @@ function sortBy(arr, sortByValue, props = "asc") {
|
|
|
80
81
|
return 0;
|
|
81
82
|
});
|
|
82
83
|
}
|
|
84
|
+
function getAscIndexOrder(index) {
|
|
85
|
+
return index === -1 ? Infinity : index ?? Infinity;
|
|
86
|
+
}
|
|
83
87
|
function arrayWithPrev(array) {
|
|
84
88
|
return array.map((item, i) => [item, array[i - 1] ?? null]);
|
|
85
89
|
}
|
|
@@ -171,6 +175,7 @@ function arrayOps(array) {
|
|
|
171
175
|
filterAndMap,
|
|
172
176
|
findAfterIndex,
|
|
173
177
|
findBeforeIndex,
|
|
178
|
+
getAscIndexOrder,
|
|
174
179
|
hasDuplicates,
|
|
175
180
|
isInArray,
|
|
176
181
|
rejectArrayUndefinedValues,
|
|
@@ -47,6 +47,24 @@ type SortByProps = {
|
|
|
47
47
|
* const sortedItems = sortBy(items, (item) => [item.a, item.b]);
|
|
48
48
|
*/
|
|
49
49
|
declare function sortBy<T>(arr: T[], sortByValue: SortByValue<T>, props?: SortByProps): T[];
|
|
50
|
+
/**
|
|
51
|
+
* Get the correct 0 based value for sync with other array in ascending order
|
|
52
|
+
*
|
|
53
|
+
* @param index
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* const items = [1, 2, 3];
|
|
58
|
+
*
|
|
59
|
+
* const index = sortBy(
|
|
60
|
+
* items,
|
|
61
|
+
* (item) => getAscIndexOrder(
|
|
62
|
+
* followOrder.findIndex((order) => order === item)
|
|
63
|
+
* )
|
|
64
|
+
* );
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
declare function getAscIndexOrder(index: number | undefined): number;
|
|
50
68
|
declare function arrayWithPrev<T>(array: T[]): [current: T, prev: T | null][];
|
|
51
69
|
declare function arrayWithPrevAndIndex<T>(array: T[]): {
|
|
52
70
|
item: T;
|
|
@@ -91,4 +109,4 @@ type ArrayOps<T> = {
|
|
|
91
109
|
*/
|
|
92
110
|
declare function arrayOps<T>(array: T[]): ArrayOps<T>;
|
|
93
111
|
|
|
94
|
-
export { type FilterAndMapReturn, arrayOps, arrayWithPrev, arrayWithPrevAndIndex, filterAndMap, findAfterIndex, findBeforeIndex, hasDuplicates, isInArray, rejectArrayUndefinedValues, rejectDuplicates, sortBy, truncateArray };
|
|
112
|
+
export { type FilterAndMapReturn, arrayOps, arrayWithPrev, arrayWithPrevAndIndex, filterAndMap, findAfterIndex, findBeforeIndex, getAscIndexOrder, hasDuplicates, isInArray, rejectArrayUndefinedValues, rejectDuplicates, sortBy, truncateArray };
|
|
@@ -47,6 +47,24 @@ type SortByProps = {
|
|
|
47
47
|
* const sortedItems = sortBy(items, (item) => [item.a, item.b]);
|
|
48
48
|
*/
|
|
49
49
|
declare function sortBy<T>(arr: T[], sortByValue: SortByValue<T>, props?: SortByProps): T[];
|
|
50
|
+
/**
|
|
51
|
+
* Get the correct 0 based value for sync with other array in ascending order
|
|
52
|
+
*
|
|
53
|
+
* @param index
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* const items = [1, 2, 3];
|
|
58
|
+
*
|
|
59
|
+
* const index = sortBy(
|
|
60
|
+
* items,
|
|
61
|
+
* (item) => getAscIndexOrder(
|
|
62
|
+
* followOrder.findIndex((order) => order === item)
|
|
63
|
+
* )
|
|
64
|
+
* );
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
declare function getAscIndexOrder(index: number | undefined): number;
|
|
50
68
|
declare function arrayWithPrev<T>(array: T[]): [current: T, prev: T | null][];
|
|
51
69
|
declare function arrayWithPrevAndIndex<T>(array: T[]): {
|
|
52
70
|
item: T;
|
|
@@ -91,4 +109,4 @@ type ArrayOps<T> = {
|
|
|
91
109
|
*/
|
|
92
110
|
declare function arrayOps<T>(array: T[]): ArrayOps<T>;
|
|
93
111
|
|
|
94
|
-
export { type FilterAndMapReturn, arrayOps, arrayWithPrev, arrayWithPrevAndIndex, filterAndMap, findAfterIndex, findBeforeIndex, hasDuplicates, isInArray, rejectArrayUndefinedValues, rejectDuplicates, sortBy, truncateArray };
|
|
112
|
+
export { type FilterAndMapReturn, arrayOps, arrayWithPrev, arrayWithPrevAndIndex, filterAndMap, findAfterIndex, findBeforeIndex, getAscIndexOrder, hasDuplicates, isInArray, rejectArrayUndefinedValues, rejectDuplicates, sortBy, truncateArray };
|
|
@@ -5,13 +5,14 @@ import {
|
|
|
5
5
|
filterAndMap,
|
|
6
6
|
findAfterIndex,
|
|
7
7
|
findBeforeIndex,
|
|
8
|
+
getAscIndexOrder,
|
|
8
9
|
hasDuplicates,
|
|
9
10
|
isInArray,
|
|
10
11
|
rejectArrayUndefinedValues,
|
|
11
12
|
rejectDuplicates,
|
|
12
13
|
sortBy,
|
|
13
14
|
truncateArray
|
|
14
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-4DVTWCXL.js";
|
|
15
16
|
import "./chunk-C2SVCIWE.js";
|
|
16
17
|
import "./chunk-JF2MDHOJ.js";
|
|
17
18
|
export {
|
|
@@ -21,6 +22,7 @@ export {
|
|
|
21
22
|
filterAndMap,
|
|
22
23
|
findAfterIndex,
|
|
23
24
|
findBeforeIndex,
|
|
25
|
+
getAscIndexOrder,
|
|
24
26
|
hasDuplicates,
|
|
25
27
|
isInArray,
|
|
26
28
|
rejectArrayUndefinedValues,
|
|
@@ -39,6 +39,9 @@ function sortBy(arr, sortByValue, props = "asc") {
|
|
|
39
39
|
return 0;
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
|
+
function getAscIndexOrder(index) {
|
|
43
|
+
return index === -1 ? Infinity : index ?? Infinity;
|
|
44
|
+
}
|
|
42
45
|
function arrayWithPrev(array) {
|
|
43
46
|
return array.map((item, i) => [item, array[i - 1] ?? null]);
|
|
44
47
|
}
|
|
@@ -126,6 +129,7 @@ function arrayOps(array) {
|
|
|
126
129
|
export {
|
|
127
130
|
filterAndMap,
|
|
128
131
|
sortBy,
|
|
132
|
+
getAscIndexOrder,
|
|
129
133
|
arrayWithPrev,
|
|
130
134
|
arrayWithPrevAndIndex,
|
|
131
135
|
isInArray,
|
|
@@ -42,6 +42,9 @@ function truncateString(str, length, ellipsis = "\u2026") {
|
|
|
42
42
|
if (str.length <= length) return str;
|
|
43
43
|
return str.slice(0, length - 1) + ellipsis;
|
|
44
44
|
}
|
|
45
|
+
function removeANSIColors(str) {
|
|
46
|
+
return str.replace(/\u001b\[\d+m/g, "");
|
|
47
|
+
}
|
|
45
48
|
|
|
46
49
|
export {
|
|
47
50
|
concatStrings,
|
|
@@ -53,5 +56,6 @@ export {
|
|
|
53
56
|
convertToCamelCase,
|
|
54
57
|
convertToSentenceCase,
|
|
55
58
|
convertToTitleCase,
|
|
56
|
-
truncateString
|
|
59
|
+
truncateString,
|
|
60
|
+
removeANSIColors
|
|
57
61
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
truncateString
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-KW55OTUG.js";
|
|
4
4
|
import {
|
|
5
5
|
sleep
|
|
6
6
|
} from "./chunk-5DZT3Z5Z.js";
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from "./chunk-VAAMRG4K.js";
|
|
10
10
|
import {
|
|
11
11
|
truncateArray
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-4DVTWCXL.js";
|
|
13
13
|
import {
|
|
14
14
|
invariant
|
|
15
15
|
} from "./chunk-C2SVCIWE.js";
|
|
@@ -29,6 +29,7 @@ __export(stringUtils_exports, {
|
|
|
29
29
|
formatNum: () => formatNum,
|
|
30
30
|
isSnakeCase: () => isSnakeCase,
|
|
31
31
|
joinStrings: () => joinStrings,
|
|
32
|
+
removeANSIColors: () => removeANSIColors,
|
|
32
33
|
truncateString: () => truncateString
|
|
33
34
|
});
|
|
34
35
|
module.exports = __toCommonJS(stringUtils_exports);
|
|
@@ -75,6 +76,9 @@ function truncateString(str, length, ellipsis = "\u2026") {
|
|
|
75
76
|
if (str.length <= length) return str;
|
|
76
77
|
return str.slice(0, length - 1) + ellipsis;
|
|
77
78
|
}
|
|
79
|
+
function removeANSIColors(str) {
|
|
80
|
+
return str.replace(/\u001b\[\d+m/g, "");
|
|
81
|
+
}
|
|
78
82
|
// Annotate the CommonJS export names for ESM import in node:
|
|
79
83
|
0 && (module.exports = {
|
|
80
84
|
concatStrings,
|
|
@@ -86,5 +90,6 @@ function truncateString(str, length, ellipsis = "\u2026") {
|
|
|
86
90
|
formatNum,
|
|
87
91
|
isSnakeCase,
|
|
88
92
|
joinStrings,
|
|
93
|
+
removeANSIColors,
|
|
89
94
|
truncateString
|
|
90
95
|
});
|
|
@@ -21,5 +21,6 @@ declare function convertToCamelCase(str: string): string;
|
|
|
21
21
|
declare function convertToSentenceCase(str: string): string;
|
|
22
22
|
declare function convertToTitleCase(str: string): string;
|
|
23
23
|
declare function truncateString(str: string, length: number, ellipsis?: string): string;
|
|
24
|
+
declare function removeANSIColors(str: string): string;
|
|
24
25
|
|
|
25
|
-
export { concatStrings, convertToCamelCase, convertToPascalCase, convertToSentenceCase, convertToSnakeCase, convertToTitleCase, formatNum, isSnakeCase, joinStrings, truncateString };
|
|
26
|
+
export { concatStrings, convertToCamelCase, convertToPascalCase, convertToSentenceCase, convertToSnakeCase, convertToTitleCase, formatNum, isSnakeCase, joinStrings, removeANSIColors, truncateString };
|
|
@@ -21,5 +21,6 @@ declare function convertToCamelCase(str: string): string;
|
|
|
21
21
|
declare function convertToSentenceCase(str: string): string;
|
|
22
22
|
declare function convertToTitleCase(str: string): string;
|
|
23
23
|
declare function truncateString(str: string, length: number, ellipsis?: string): string;
|
|
24
|
+
declare function removeANSIColors(str: string): string;
|
|
24
25
|
|
|
25
|
-
export { concatStrings, convertToCamelCase, convertToPascalCase, convertToSentenceCase, convertToSnakeCase, convertToTitleCase, formatNum, isSnakeCase, joinStrings, truncateString };
|
|
26
|
+
export { concatStrings, convertToCamelCase, convertToPascalCase, convertToSentenceCase, convertToSnakeCase, convertToTitleCase, formatNum, isSnakeCase, joinStrings, removeANSIColors, truncateString };
|
|
@@ -8,8 +8,9 @@ import {
|
|
|
8
8
|
formatNum,
|
|
9
9
|
isSnakeCase,
|
|
10
10
|
joinStrings,
|
|
11
|
+
removeANSIColors,
|
|
11
12
|
truncateString
|
|
12
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-KW55OTUG.js";
|
|
13
14
|
export {
|
|
14
15
|
concatStrings,
|
|
15
16
|
convertToCamelCase,
|
|
@@ -20,5 +21,6 @@ export {
|
|
|
20
21
|
formatNum,
|
|
21
22
|
isSnakeCase,
|
|
22
23
|
joinStrings,
|
|
24
|
+
removeANSIColors,
|
|
23
25
|
truncateString
|
|
24
26
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
yamlStringify
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-ADM37GSC.js";
|
|
4
4
|
import {
|
|
5
5
|
omit,
|
|
6
6
|
pick
|
|
@@ -11,18 +11,18 @@ import {
|
|
|
11
11
|
} from "./chunk-JQFUKJU5.js";
|
|
12
12
|
import {
|
|
13
13
|
filterObjectOrArrayKeys
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-XPOGWCUC.js";
|
|
15
15
|
import {
|
|
16
16
|
defer
|
|
17
17
|
} from "./chunk-DFXNVEH6.js";
|
|
18
18
|
import {
|
|
19
19
|
clampMin
|
|
20
20
|
} from "./chunk-HTCYUMDR.js";
|
|
21
|
-
import "./chunk-
|
|
21
|
+
import "./chunk-KW55OTUG.js";
|
|
22
22
|
import {
|
|
23
23
|
arrayWithPrevAndIndex,
|
|
24
24
|
filterAndMap
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-4DVTWCXL.js";
|
|
26
26
|
import {
|
|
27
27
|
isObject
|
|
28
28
|
} from "./chunk-C2SVCIWE.js";
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
type ArrayOps<T> = object;
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
Defined in: [packages/utils/src/arrayUtils.ts:
|
|
17
|
+
Defined in: [packages/utils/src/arrayUtils.ts:259](https://github.com/lucasols/utils/blob/main/packages/utils/src/arrayUtils.ts#L259)
|
|
18
18
|
|
|
19
19
|
#### Type Parameters
|
|
20
20
|
|
|
@@ -30,7 +30,7 @@ Defined in: [packages/utils/src/arrayUtils.ts:238](https://github.com/lucasols/u
|
|
|
30
30
|
filterAndMap: <R>(mapFilter) => R[];
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
-
Defined in: [packages/utils/src/arrayUtils.ts:
|
|
33
|
+
Defined in: [packages/utils/src/arrayUtils.ts:272](https://github.com/lucasols/utils/blob/main/packages/utils/src/arrayUtils.ts#L272)
|
|
34
34
|
|
|
35
35
|
Filter and map an array
|
|
36
36
|
|
|
@@ -69,7 +69,7 @@ enhancedItems.filterAndMap((item) => item === 2 ? false : item);
|
|
|
69
69
|
rejectDuplicates: (getKey) => T[];
|
|
70
70
|
```
|
|
71
71
|
|
|
72
|
-
Defined in: [packages/utils/src/arrayUtils.ts:
|
|
72
|
+
Defined in: [packages/utils/src/arrayUtils.ts:274](https://github.com/lucasols/utils/blob/main/packages/utils/src/arrayUtils.ts#L274)
|
|
73
73
|
|
|
74
74
|
###### Parameters
|
|
75
75
|
|
|
@@ -87,7 +87,7 @@ Defined in: [packages/utils/src/arrayUtils.ts:253](https://github.com/lucasols/u
|
|
|
87
87
|
sortBy: (sortByValue, props) => T[];
|
|
88
88
|
```
|
|
89
89
|
|
|
90
|
-
Defined in: [packages/utils/src/arrayUtils.ts:
|
|
90
|
+
Defined in: [packages/utils/src/arrayUtils.ts:273](https://github.com/lucasols/utils/blob/main/packages/utils/src/arrayUtils.ts#L273)
|
|
91
91
|
|
|
92
92
|
###### Parameters
|
|
93
93
|
|
|
@@ -34,7 +34,7 @@ Defined in: [packages/utils/src/arrayUtils.ts:42](https://github.com/lucasols/ut
|
|
|
34
34
|
function arrayOps<T>(array): ArrayOps<T>;
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
Defined in: [packages/utils/src/arrayUtils.ts:
|
|
37
|
+
Defined in: [packages/utils/src/arrayUtils.ts:289](https://github.com/lucasols/utils/blob/main/packages/utils/src/arrayUtils.ts#L289)
|
|
38
38
|
|
|
39
39
|
Enhance an array with extra methods
|
|
40
40
|
|
|
@@ -72,7 +72,7 @@ enhancedItems.rejectDuplicates((item) => item);
|
|
|
72
72
|
function arrayWithPrev<T>(array): [T, null | T][];
|
|
73
73
|
```
|
|
74
74
|
|
|
75
|
-
Defined in: [packages/utils/src/arrayUtils.ts:
|
|
75
|
+
Defined in: [packages/utils/src/arrayUtils.ts:138](https://github.com/lucasols/utils/blob/main/packages/utils/src/arrayUtils.ts#L138)
|
|
76
76
|
|
|
77
77
|
#### Type Parameters
|
|
78
78
|
|
|
@@ -98,7 +98,7 @@ Defined in: [packages/utils/src/arrayUtils.ts:117](https://github.com/lucasols/u
|
|
|
98
98
|
function arrayWithPrevAndIndex<T>(array): object[];
|
|
99
99
|
```
|
|
100
100
|
|
|
101
|
-
Defined in: [packages/utils/src/arrayUtils.ts:
|
|
101
|
+
Defined in: [packages/utils/src/arrayUtils.ts:142](https://github.com/lucasols/utils/blob/main/packages/utils/src/arrayUtils.ts#L142)
|
|
102
102
|
|
|
103
103
|
#### Type Parameters
|
|
104
104
|
|
|
@@ -181,7 +181,7 @@ function findAfterIndex<T>(
|
|
|
181
181
|
predicate): undefined | T;
|
|
182
182
|
```
|
|
183
183
|
|
|
184
|
-
Defined in: [packages/utils/src/arrayUtils.ts:
|
|
184
|
+
Defined in: [packages/utils/src/arrayUtils.ts:165](https://github.com/lucasols/utils/blob/main/packages/utils/src/arrayUtils.ts#L165)
|
|
185
185
|
|
|
186
186
|
#### Type Parameters
|
|
187
187
|
|
|
@@ -218,7 +218,7 @@ function findBeforeIndex<T>(
|
|
|
218
218
|
predicate): undefined | T;
|
|
219
219
|
```
|
|
220
220
|
|
|
221
|
-
Defined in: [packages/utils/src/arrayUtils.ts:
|
|
221
|
+
Defined in: [packages/utils/src/arrayUtils.ts:179](https://github.com/lucasols/utils/blob/main/packages/utils/src/arrayUtils.ts#L179)
|
|
222
222
|
|
|
223
223
|
#### Type Parameters
|
|
224
224
|
|
|
@@ -246,13 +246,48 @@ Defined in: [packages/utils/src/arrayUtils.ts:158](https://github.com/lucasols/u
|
|
|
246
246
|
|
|
247
247
|
***
|
|
248
248
|
|
|
249
|
+
### getAscIndexOrder()
|
|
250
|
+
|
|
251
|
+
```ts
|
|
252
|
+
function getAscIndexOrder(index): number;
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
Defined in: [packages/utils/src/arrayUtils.ts:134](https://github.com/lucasols/utils/blob/main/packages/utils/src/arrayUtils.ts#L134)
|
|
256
|
+
|
|
257
|
+
Get the correct 0 based value for sync with other array in ascending order
|
|
258
|
+
|
|
259
|
+
#### Parameters
|
|
260
|
+
|
|
261
|
+
##### index
|
|
262
|
+
|
|
263
|
+
`undefined` | `number`
|
|
264
|
+
|
|
265
|
+
#### Returns
|
|
266
|
+
|
|
267
|
+
`number`
|
|
268
|
+
|
|
269
|
+
#### Example
|
|
270
|
+
|
|
271
|
+
```ts
|
|
272
|
+
const items = [1, 2, 3];
|
|
273
|
+
|
|
274
|
+
const index = sortBy(
|
|
275
|
+
items,
|
|
276
|
+
(item) => getAscIndexOrder(
|
|
277
|
+
followOrder.findIndex((order) => order === item)
|
|
278
|
+
)
|
|
279
|
+
);
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
***
|
|
283
|
+
|
|
249
284
|
### hasDuplicates()
|
|
250
285
|
|
|
251
286
|
```ts
|
|
252
287
|
function hasDuplicates<T>(array, getKey): boolean;
|
|
253
288
|
```
|
|
254
289
|
|
|
255
|
-
Defined in: [packages/utils/src/arrayUtils.ts:
|
|
290
|
+
Defined in: [packages/utils/src/arrayUtils.ts:203](https://github.com/lucasols/utils/blob/main/packages/utils/src/arrayUtils.ts#L203)
|
|
256
291
|
|
|
257
292
|
#### Type Parameters
|
|
258
293
|
|
|
@@ -282,7 +317,7 @@ Defined in: [packages/utils/src/arrayUtils.ts:182](https://github.com/lucasols/u
|
|
|
282
317
|
function isInArray<T, U>(value, oneOf): value is U;
|
|
283
318
|
```
|
|
284
319
|
|
|
285
|
-
Defined in: [packages/utils/src/arrayUtils.ts:
|
|
320
|
+
Defined in: [packages/utils/src/arrayUtils.ts:152](https://github.com/lucasols/utils/blob/main/packages/utils/src/arrayUtils.ts#L152)
|
|
286
321
|
|
|
287
322
|
#### Type Parameters
|
|
288
323
|
|
|
@@ -316,7 +351,7 @@ readonly `U`[]
|
|
|
316
351
|
function rejectArrayUndefinedValues<T>(array): T;
|
|
317
352
|
```
|
|
318
353
|
|
|
319
|
-
Defined in: [packages/utils/src/arrayUtils.ts:
|
|
354
|
+
Defined in: [packages/utils/src/arrayUtils.ts:199](https://github.com/lucasols/utils/blob/main/packages/utils/src/arrayUtils.ts#L199)
|
|
320
355
|
|
|
321
356
|
#### Type Parameters
|
|
322
357
|
|
|
@@ -342,7 +377,7 @@ Defined in: [packages/utils/src/arrayUtils.ts:178](https://github.com/lucasols/u
|
|
|
342
377
|
function rejectDuplicates<T>(array, getKey): T[];
|
|
343
378
|
```
|
|
344
379
|
|
|
345
|
-
Defined in: [packages/utils/src/arrayUtils.ts:
|
|
380
|
+
Defined in: [packages/utils/src/arrayUtils.ts:220](https://github.com/lucasols/utils/blob/main/packages/utils/src/arrayUtils.ts#L220)
|
|
346
381
|
|
|
347
382
|
#### Type Parameters
|
|
348
383
|
|
|
@@ -432,7 +467,7 @@ function truncateArray<T>(
|
|
|
432
467
|
appendIfTruncated?): T[];
|
|
433
468
|
```
|
|
434
469
|
|
|
435
|
-
Defined in: [packages/utils/src/arrayUtils.ts:
|
|
470
|
+
Defined in: [packages/utils/src/arrayUtils.ts:240](https://github.com/lucasols/utils/blob/main/packages/utils/src/arrayUtils.ts#L240)
|
|
436
471
|
|
|
437
472
|
#### Type Parameters
|
|
438
473
|
|
|
@@ -220,6 +220,26 @@ Defined in: [packages/utils/src/stringUtils.ts:50](https://github.com/lucasols/u
|
|
|
220
220
|
|
|
221
221
|
***
|
|
222
222
|
|
|
223
|
+
### removeANSIColors()
|
|
224
|
+
|
|
225
|
+
```ts
|
|
226
|
+
function removeANSIColors(str): string;
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
Defined in: [packages/utils/src/stringUtils.ts:98](https://github.com/lucasols/utils/blob/main/packages/utils/src/stringUtils.ts#L98)
|
|
230
|
+
|
|
231
|
+
#### Parameters
|
|
232
|
+
|
|
233
|
+
##### str
|
|
234
|
+
|
|
235
|
+
`string`
|
|
236
|
+
|
|
237
|
+
#### Returns
|
|
238
|
+
|
|
239
|
+
`string`
|
|
240
|
+
|
|
241
|
+
***
|
|
242
|
+
|
|
223
243
|
### truncateString()
|
|
224
244
|
|
|
225
245
|
```ts
|