@ls-stack/utils 3.67.0 → 3.69.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.mjs +1 -1
- package/dist/{assertions-qMxfVhSu.mjs → assertions-B9119Soz.mjs} +1 -1
- package/dist/assertions.mjs +1 -1
- package/dist/asyncQueue.mjs +1 -1
- package/dist/cache.mjs +2 -2
- package/dist/castValues.mjs +1 -1
- package/dist/concurrentCalls.mjs +3 -3
- package/dist/conversions.mjs +1 -1
- package/dist/createThrottleController.mjs +1 -1
- package/dist/deepEqual.mjs +1 -1
- package/dist/deepReplaceValues.mjs +1 -1
- package/dist/enhancedMap.mjs +1 -1
- package/dist/filterObjectOrArrayKeys.mjs +1 -1
- package/dist/fuzzySearch.d.mts +55 -0
- package/dist/fuzzySearch.mjs +102 -0
- package/dist/getCompositeKey.mjs +1 -1
- package/dist/interpolate.mjs +2 -2
- package/dist/keepPrevIfUnchanged.mjs +1 -1
- package/dist/mathUtils.mjs +1 -1
- package/dist/mockList.d.mts +15 -0
- package/dist/mockList.mjs +41 -0
- package/dist/mutationUtils.mjs +1 -1
- package/dist/objUtils.mjs +1 -1
- package/dist/parallelAsyncCalls.mjs +1 -1
- package/dist/partialEqual.mjs +1 -1
- package/dist/saferTyping.d.mts +6 -1
- package/dist/saferTyping.mjs +8 -1
- package/dist/serializeXML.mjs +1 -1
- package/dist/stringUtils.mjs +1 -1
- package/dist/testUtils.mjs +5 -5
- package/dist/{time-sr2lhQRw.mjs → time-BJXm2Xv6.mjs} +2 -2
- package/dist/time.mjs +1 -1
- package/dist/tsResult.mjs +1 -1
- package/dist/typeGuards.mjs +1 -1
- package/dist/typingFnUtils.mjs +1 -1
- package/dist/yamlStringify.mjs +3 -3
- package/package.json +7 -3
- /package/dist/{castValues-DfICShCc.mjs → castValues-BPls1LFT.mjs} +0 -0
- /package/dist/{conversions-DTmwEMIu.mjs → conversions-DAWknpNd.mjs} +0 -0
- /package/dist/{deepEqual-C7EZEixx.mjs → deepEqual-CJIwfxEt.mjs} +0 -0
- /package/dist/{mathUtils-BDP1lM_z.mjs → mathUtils-Cl8qZbfS.mjs} +0 -0
- /package/dist/{stringUtils-DjhWOiYn.mjs → stringUtils-e-95_mNH.mjs} +0 -0
- /package/dist/{typeGuards-B1mzA-Rz.mjs → typeGuards-CSaHQdO9.mjs} +0 -0
- /package/dist/{typingFnUtils-Bb8drgKF.mjs → typingFnUtils-OK4g7kki.mjs} +0 -0
package/dist/arrayUtils.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as isPlainObject$1, i as isObject$1, n as isFunction$1, o as isPromise$1 } from "./typeGuards-
|
|
1
|
+
import { a as isPlainObject$1, i as isObject$1, n as isFunction$1, o as isPromise$1 } from "./typeGuards-CSaHQdO9.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/assertions.ts
|
|
4
4
|
const undefErrMsg = "not undefined assertion failed";
|
package/dist/assertions.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as isFunction, c as isPromise, i as invariant, l as notNullish, n as assertIsNotUndefined, o as isObject, r as exhaustiveCheck, s as isPlainObject, t as assertIsNotNullish, u as notUndefined } from "./assertions-
|
|
1
|
+
import { a as isFunction, c as isPromise, i as invariant, l as notNullish, n as assertIsNotUndefined, o as isObject, r as exhaustiveCheck, s as isPlainObject, t as assertIsNotNullish, u as notUndefined } from "./assertions-B9119Soz.mjs";
|
|
2
2
|
|
|
3
3
|
export { assertIsNotNullish, assertIsNotUndefined, exhaustiveCheck, invariant, isFunction, isObject, isPlainObject, isPromise, notNullish, notUndefined };
|
package/dist/asyncQueue.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defer } from "./promiseUtils.mjs";
|
|
2
|
-
import { p as durationObjToMs } from "./time-
|
|
2
|
+
import { p as durationObjToMs } from "./time-BJXm2Xv6.mjs";
|
|
3
3
|
import { evtmitter } from "evtmitter";
|
|
4
4
|
import { Result, isResult, resultify, unknownToError } from "t-result";
|
|
5
5
|
|
package/dist/cache.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as isPromise } from "./assertions-
|
|
2
|
-
import { p as durationObjToMs } from "./time-
|
|
1
|
+
import { c as isPromise } from "./assertions-B9119Soz.mjs";
|
|
2
|
+
import { p as durationObjToMs } from "./time-BJXm2Xv6.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/cache.ts
|
|
5
5
|
/**
|
package/dist/castValues.mjs
CHANGED
package/dist/concurrentCalls.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { i as isObject, o as isPromise } from "./typeGuards-
|
|
2
|
-
import { i as invariant } from "./assertions-
|
|
1
|
+
import { i as isObject, o as isPromise } from "./typeGuards-CSaHQdO9.mjs";
|
|
2
|
+
import { i as invariant } from "./assertions-B9119Soz.mjs";
|
|
3
3
|
import { truncateArray } from "./arrayUtils.mjs";
|
|
4
4
|
import { safeJsonStringify } from "./safeJson.mjs";
|
|
5
5
|
import { sleep } from "./sleep.mjs";
|
|
6
|
-
import { C as truncateString } from "./stringUtils-
|
|
6
|
+
import { C as truncateString } from "./stringUtils-e-95_mNH.mjs";
|
|
7
7
|
import { Result, resultify, unknownToError } from "t-result";
|
|
8
8
|
|
|
9
9
|
//#region src/concurrentCalls.ts
|
package/dist/conversions.mjs
CHANGED
package/dist/deepEqual.mjs
CHANGED
package/dist/enhancedMap.mjs
CHANGED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import uFuzzy from "@leeoniya/ufuzzy";
|
|
2
|
+
|
|
3
|
+
//#region src/fuzzySearch.d.ts
|
|
4
|
+
type SearchOptions<T> = {
|
|
5
|
+
items: T[];
|
|
6
|
+
getStringToMatch: (item: T) => string;
|
|
7
|
+
searchQuery: string | null;
|
|
8
|
+
/** Pass a stable uFuzzy instance, you can use `getUFuzzyInstance` for this */
|
|
9
|
+
uFuzzy: uFuzzy;
|
|
10
|
+
ignoreBestMatch?: boolean;
|
|
11
|
+
throwOnError?: boolean;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Performs fuzzy search on a list of items and returns matched items with score
|
|
15
|
+
* metadata.
|
|
16
|
+
*
|
|
17
|
+
* Uses uFuzzy for efficient fuzzy matching with Latin character normalization.
|
|
18
|
+
* Falls back to simple string inclusion matching if an error occurs.
|
|
19
|
+
*
|
|
20
|
+
* @returns Object containing filtered/sorted items and the best match score
|
|
21
|
+
* (higher is better)
|
|
22
|
+
*/
|
|
23
|
+
declare function fuzzySearchItemsWithResultMetadata<T>({
|
|
24
|
+
items,
|
|
25
|
+
searchQuery: _searchQuery,
|
|
26
|
+
getStringToMatch,
|
|
27
|
+
uFuzzy: uf,
|
|
28
|
+
ignoreBestMatch,
|
|
29
|
+
throwOnError
|
|
30
|
+
}: SearchOptions<T>): {
|
|
31
|
+
items: T[];
|
|
32
|
+
bestMatchScore: number;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Performs fuzzy search on a list of items and returns matched items.
|
|
36
|
+
*
|
|
37
|
+
* Simplified version of `fuzzySearchItemsWithResultMetadata` that only returns
|
|
38
|
+
* items.
|
|
39
|
+
*/
|
|
40
|
+
declare function fuzzySearchItems<T>({
|
|
41
|
+
items,
|
|
42
|
+
searchQuery: _searchQuery,
|
|
43
|
+
getStringToMatch,
|
|
44
|
+
uFuzzy: uf
|
|
45
|
+
}: Omit<SearchOptions<T>, 'ignoreBestMatch'>): T[];
|
|
46
|
+
/**
|
|
47
|
+
* Creates a configured uFuzzy instance with custom sorting for optimal fuzzy
|
|
48
|
+
* matching.
|
|
49
|
+
*
|
|
50
|
+
* The instance uses intraMode=1 and custom sorting that prioritizes: contiguous
|
|
51
|
+
* character matches, prefix bounds, match density, and early start position.
|
|
52
|
+
*/
|
|
53
|
+
declare function getUFuzzyInstance(): uFuzzy;
|
|
54
|
+
//#endregion
|
|
55
|
+
export { fuzzySearchItems, fuzzySearchItemsWithResultMetadata, getUFuzzyInstance };
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import uFuzzy from "@leeoniya/ufuzzy";
|
|
2
|
+
|
|
3
|
+
//#region src/fuzzySearch.ts
|
|
4
|
+
/**
|
|
5
|
+
* Performs fuzzy search on a list of items and returns matched items with score
|
|
6
|
+
* metadata.
|
|
7
|
+
*
|
|
8
|
+
* Uses uFuzzy for efficient fuzzy matching with Latin character normalization.
|
|
9
|
+
* Falls back to simple string inclusion matching if an error occurs.
|
|
10
|
+
*
|
|
11
|
+
* @returns Object containing filtered/sorted items and the best match score
|
|
12
|
+
* (higher is better)
|
|
13
|
+
*/
|
|
14
|
+
function fuzzySearchItemsWithResultMetadata({ items, searchQuery: _searchQuery, getStringToMatch, uFuzzy: uf, ignoreBestMatch, throwOnError }) {
|
|
15
|
+
const searchQuery = normalizeSearchQuery(_searchQuery ?? "");
|
|
16
|
+
if (!searchQuery) return {
|
|
17
|
+
items,
|
|
18
|
+
bestMatchScore: 0
|
|
19
|
+
};
|
|
20
|
+
try {
|
|
21
|
+
const searchStrings = items.map((item) => uFuzzy.latinize(getStringToMatch(item)));
|
|
22
|
+
let [filteredIndexes, info, orderedIndexes] = uf.search(searchStrings, searchQuery);
|
|
23
|
+
if (!filteredIndexes) filteredIndexes = [];
|
|
24
|
+
const sortedItems = [];
|
|
25
|
+
let bestMatchScore = void 0;
|
|
26
|
+
if (orderedIndexes) for (const filteredIndex of orderedIndexes) {
|
|
27
|
+
const index = filteredIndexes[filteredIndex];
|
|
28
|
+
const item = items[index];
|
|
29
|
+
if (item) {
|
|
30
|
+
if (!ignoreBestMatch && bestMatchScore === void 0 && info) {
|
|
31
|
+
const start = info.start[filteredIndex] ?? 0;
|
|
32
|
+
const chars = info.chars[filteredIndex] ?? 0;
|
|
33
|
+
const terms = info.terms[filteredIndex] ?? 0;
|
|
34
|
+
const inter = (info.interLft2[filteredIndex] ?? 0) + (info.interRgt2[filteredIndex] ?? 0);
|
|
35
|
+
bestMatchScore = 50 - start;
|
|
36
|
+
const intra = info.intraIns[filteredIndex] ?? 0;
|
|
37
|
+
const density = chars / (searchStrings[index]?.length ?? 0);
|
|
38
|
+
bestMatchScore += density * 10;
|
|
39
|
+
bestMatchScore += terms * 10;
|
|
40
|
+
bestMatchScore += inter * 10;
|
|
41
|
+
bestMatchScore += intra * 10;
|
|
42
|
+
}
|
|
43
|
+
sortedItems.push(item);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
else for (const i of filteredIndexes) if (items[i]) sortedItems.push(items[i]);
|
|
47
|
+
return {
|
|
48
|
+
items: sortedItems,
|
|
49
|
+
bestMatchScore: bestMatchScore ?? 0
|
|
50
|
+
};
|
|
51
|
+
} catch (e) {
|
|
52
|
+
if (throwOnError) throw e;
|
|
53
|
+
console.error(e);
|
|
54
|
+
return {
|
|
55
|
+
items: items.filter((item) => getStringToMatch(item).includes(searchQuery)),
|
|
56
|
+
bestMatchScore: 0
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Performs fuzzy search on a list of items and returns matched items.
|
|
62
|
+
*
|
|
63
|
+
* Simplified version of `fuzzySearchItemsWithResultMetadata` that only returns
|
|
64
|
+
* items.
|
|
65
|
+
*/
|
|
66
|
+
function fuzzySearchItems({ items, searchQuery: _searchQuery, getStringToMatch, uFuzzy: uf }) {
|
|
67
|
+
return fuzzySearchItemsWithResultMetadata({
|
|
68
|
+
items,
|
|
69
|
+
searchQuery: _searchQuery,
|
|
70
|
+
getStringToMatch,
|
|
71
|
+
uFuzzy: uf,
|
|
72
|
+
ignoreBestMatch: true
|
|
73
|
+
}).items;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Creates a configured uFuzzy instance with custom sorting for optimal fuzzy
|
|
77
|
+
* matching.
|
|
78
|
+
*
|
|
79
|
+
* The instance uses intraMode=1 and custom sorting that prioritizes: contiguous
|
|
80
|
+
* character matches, prefix bounds, match density, and early start position.
|
|
81
|
+
*/
|
|
82
|
+
function getUFuzzyInstance() {
|
|
83
|
+
return new uFuzzy({
|
|
84
|
+
intraMode: 1,
|
|
85
|
+
sort(info, haystack) {
|
|
86
|
+
const { idx, chars, terms, interLft2, interLft1, start, intraIns, interIns } = info;
|
|
87
|
+
return idx.map((_, i) => i).sort((ia, ib) => chars[ib] - chars[ia] || intraIns[ia] - intraIns[ib] || terms[ib] + interLft2[ib] + .5 * interLft1[ib] - (terms[ia] + interLft2[ia] + .5 * interLft1[ia]) || interIns[ia] - interIns[ib] || start[ia] - start[ib] || haystack[idx[ia]].length - haystack[idx[ib]].length || cmp(haystack[idx[ia]], haystack[idx[ib]]));
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
const cmp = new Intl.Collator("en", {
|
|
92
|
+
numeric: true,
|
|
93
|
+
sensitivity: "base"
|
|
94
|
+
}).compare;
|
|
95
|
+
function normalizeSearchQuery(searchQuery) {
|
|
96
|
+
let normalized = searchQuery.trim();
|
|
97
|
+
normalized = uFuzzy.latinize(normalized);
|
|
98
|
+
return normalized;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
//#endregion
|
|
102
|
+
export { fuzzySearchItems, fuzzySearchItemsWithResultMetadata, getUFuzzyInstance };
|
package/dist/getCompositeKey.mjs
CHANGED
package/dist/interpolate.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as invariant } from "./assertions-
|
|
2
|
-
import { a as clampRange, i as clampMin, r as clampMax } from "./mathUtils-
|
|
1
|
+
import { i as invariant } from "./assertions-B9119Soz.mjs";
|
|
2
|
+
import { a as clampRange, i as clampMin, r as clampMax } from "./mathUtils-Cl8qZbfS.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/interpolate.ts
|
|
5
5
|
function mod(n, m) {
|
package/dist/mathUtils.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as clampRange, c as round, i as clampMin, l as roundToStep, n as clamp, o as fixFloatingPointNumber, r as clampMax, s as floorToStep, t as ceilToStep } from "./mathUtils-
|
|
1
|
+
import { a as clampRange, c as round, i as clampMin, l as roundToStep, n as clamp, o as fixFloatingPointNumber, r as clampMax, s as floorToStep, t as ceilToStep } from "./mathUtils-Cl8qZbfS.mjs";
|
|
2
2
|
|
|
3
3
|
export { ceilToStep, clamp, clampMax, clampMin, clampRange, fixFloatingPointNumber, floorToStep, round, roundToStep };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/mockList.d.ts
|
|
2
|
+
type ItemProps = {
|
|
3
|
+
index: number;
|
|
4
|
+
id: number;
|
|
5
|
+
onEvery: <T, O = undefined>(index: number, value: T, otherwise?: O) => T | O;
|
|
6
|
+
onEven: <T, O = undefined>(value: T, otherwise?: O) => T | O;
|
|
7
|
+
atIndex: <T, O = undefined>(index: number, value: T, otherwise?: O) => T | O;
|
|
8
|
+
atId: <T, O = undefined>(id: number, value: T, otherwise?: O) => T | O;
|
|
9
|
+
cycle: <V, T = V>(valuesToCycle: V[], getValue?: (v: V) => T) => T;
|
|
10
|
+
afterOrEqualIndex: <T>(index: number, value: T, otherwise?: T) => T | undefined;
|
|
11
|
+
afterOrEqualId: <T, O = undefined>(id: number, value: T, otherwise?: O) => T | O;
|
|
12
|
+
};
|
|
13
|
+
declare function mockList<T>(size: number, getItems: (itemProps: ItemProps) => T): T[];
|
|
14
|
+
//#endregion
|
|
15
|
+
export { mockList };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { i as invariant } from "./assertions-B9119Soz.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/mockList.ts
|
|
4
|
+
function mockList(size, getItems) {
|
|
5
|
+
return Array.from({ length: size }, (_, index) => getItems({
|
|
6
|
+
index,
|
|
7
|
+
id: index + 1,
|
|
8
|
+
onEvery: (everyIndex, value, otherwise) => {
|
|
9
|
+
if (index % everyIndex === 0) return value;
|
|
10
|
+
return otherwise;
|
|
11
|
+
},
|
|
12
|
+
onEven: (value, otherwise) => {
|
|
13
|
+
if (index % 2 === 0) return value;
|
|
14
|
+
return otherwise;
|
|
15
|
+
},
|
|
16
|
+
atIndex: (i, value, otherwise) => {
|
|
17
|
+
if (i === index) return value;
|
|
18
|
+
return otherwise;
|
|
19
|
+
},
|
|
20
|
+
cycle: (valuesToCycle, getValue) => {
|
|
21
|
+
const cycleValue = valuesToCycle[index % valuesToCycle.length];
|
|
22
|
+
invariant(cycleValue !== void 0);
|
|
23
|
+
return getValue ? getValue(cycleValue) : cycleValue;
|
|
24
|
+
},
|
|
25
|
+
afterOrEqualIndex: (i, value, otherwise) => {
|
|
26
|
+
if (index >= i) return value;
|
|
27
|
+
return otherwise;
|
|
28
|
+
},
|
|
29
|
+
afterOrEqualId: (id, value, otherwise) => {
|
|
30
|
+
if (index + 1 >= id) return value;
|
|
31
|
+
return otherwise;
|
|
32
|
+
},
|
|
33
|
+
atId: (id, value, otherwise) => {
|
|
34
|
+
if (index + 1 === id) return value;
|
|
35
|
+
return otherwise;
|
|
36
|
+
}
|
|
37
|
+
}));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
//#endregion
|
|
41
|
+
export { mockList };
|
package/dist/mutationUtils.mjs
CHANGED
package/dist/objUtils.mjs
CHANGED
package/dist/partialEqual.mjs
CHANGED
package/dist/saferTyping.d.mts
CHANGED
|
@@ -44,5 +44,10 @@ declare function __FIX_THIS_TYPING__(value: unknown): __LEGIT_ANY__;
|
|
|
44
44
|
* symbol, bigint, ...) Equivalent to `object` type
|
|
45
45
|
*/
|
|
46
46
|
type AnyNonPrimitiveValue = object;
|
|
47
|
+
/**
|
|
48
|
+
* Cast any value to a string. Use this when you have legit usage of string
|
|
49
|
+
* casting.
|
|
50
|
+
*/
|
|
51
|
+
declare function __UNSAFE_TO_STRING__(value: unknown): string;
|
|
47
52
|
//#endregion
|
|
48
|
-
export { AnyNonPrimitiveValue, EmptyObject, __FIX_THIS_CASTING__, __FIX_THIS_TYPING__, __LEGIT_ANY_CAST__, __LEGIT_ANY_FUNCTION__, __LEGIT_ANY__, __LEGIT_CAST__, __REFINE_CAST__ };
|
|
53
|
+
export { AnyNonPrimitiveValue, EmptyObject, __FIX_THIS_CASTING__, __FIX_THIS_TYPING__, __LEGIT_ANY_CAST__, __LEGIT_ANY_FUNCTION__, __LEGIT_ANY__, __LEGIT_CAST__, __REFINE_CAST__, __UNSAFE_TO_STRING__ };
|
package/dist/saferTyping.mjs
CHANGED
|
@@ -40,6 +40,13 @@ function __FIX_THIS_CASTING__(value) {
|
|
|
40
40
|
function __FIX_THIS_TYPING__(value) {
|
|
41
41
|
return value;
|
|
42
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Cast any value to a string. Use this when you have legit usage of string
|
|
45
|
+
* casting.
|
|
46
|
+
*/
|
|
47
|
+
function __UNSAFE_TO_STRING__(value) {
|
|
48
|
+
return String(value);
|
|
49
|
+
}
|
|
43
50
|
|
|
44
51
|
//#endregion
|
|
45
|
-
export { __FIX_THIS_CASTING__, __FIX_THIS_TYPING__, __LEGIT_ANY_CAST__, __LEGIT_CAST__, __REFINE_CAST__ };
|
|
52
|
+
export { __FIX_THIS_CASTING__, __FIX_THIS_TYPING__, __LEGIT_ANY_CAST__, __LEGIT_CAST__, __REFINE_CAST__, __UNSAFE_TO_STRING__ };
|
package/dist/serializeXML.mjs
CHANGED
package/dist/stringUtils.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { C as truncateString, S as removeANSIColors, _ as isPathCase, a as convertToKebabCase, b as isTitleCase, c as convertToSentenceCase, d as formatNum, f as isCamelCase, g as isPascalCase, h as isKebabCase, i as convertToDotCase, l as convertToSnakeCase, m as isDotCase, n as convertToCamelCase, o as convertToPascalCase, p as isConstantCase, r as convertToConstantCase, s as convertToPathCase, t as concatStrings, u as convertToTitleCase, v as isSentenceCase, x as joinStrings, y as isSnakeCase } from "./stringUtils-
|
|
1
|
+
import { C as truncateString, S as removeANSIColors, _ as isPathCase, a as convertToKebabCase, b as isTitleCase, c as convertToSentenceCase, d as formatNum, f as isCamelCase, g as isPascalCase, h as isKebabCase, i as convertToDotCase, l as convertToSnakeCase, m as isDotCase, n as convertToCamelCase, o as convertToPascalCase, p as isConstantCase, r as convertToConstantCase, s as convertToPathCase, t as concatStrings, u as convertToTitleCase, v as isSentenceCase, x as joinStrings, y as isSnakeCase } from "./stringUtils-e-95_mNH.mjs";
|
|
2
2
|
|
|
3
3
|
export { concatStrings, convertToCamelCase, convertToConstantCase, convertToDotCase, convertToKebabCase, convertToPascalCase, convertToPathCase, convertToSentenceCase, convertToSnakeCase, convertToTitleCase, formatNum, isCamelCase, isConstantCase, isDotCase, isKebabCase, isPascalCase, isPathCase, isSentenceCase, isSnakeCase, isTitleCase, joinStrings, removeANSIColors, truncateString };
|
package/dist/testUtils.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { a as isPlainObject } from "./typeGuards-
|
|
2
|
-
import { o as isObject } from "./assertions-
|
|
1
|
+
import { a as isPlainObject } from "./typeGuards-CSaHQdO9.mjs";
|
|
2
|
+
import { o as isObject } from "./assertions-B9119Soz.mjs";
|
|
3
3
|
import { arrayWithPrevAndIndex, filterAndMap } from "./arrayUtils.mjs";
|
|
4
4
|
import { defer } from "./promiseUtils.mjs";
|
|
5
|
-
import { i as clampMin } from "./mathUtils-
|
|
6
|
-
import { t as deepEqual } from "./deepEqual-
|
|
5
|
+
import { i as clampMin } from "./mathUtils-Cl8qZbfS.mjs";
|
|
6
|
+
import { t as deepEqual } from "./deepEqual-CJIwfxEt.mjs";
|
|
7
7
|
import { deepReplaceValues } from "./deepReplaceValues.mjs";
|
|
8
8
|
import { filterObjectOrArrayKeys } from "./filterObjectOrArrayKeys.mjs";
|
|
9
9
|
import { omit, pick } from "./objUtils.mjs";
|
|
@@ -241,7 +241,7 @@ function waitController() {
|
|
|
241
241
|
*/
|
|
242
242
|
function compactSnapshot(value, { collapseObjects = true, maxLineLength = 100, showUndefined = false, showBooleansAs = true, replaceValues, rejectKeys, filterKeys, sortKeys, sortPatterns, ...options } = {}) {
|
|
243
243
|
let processedValue = value;
|
|
244
|
-
if (rejectKeys || filterKeys) {
|
|
244
|
+
if (rejectKeys || filterKeys || sortKeys || sortPatterns) {
|
|
245
245
|
if (isPlainObject(processedValue) || Array.isArray(processedValue)) processedValue = filterObjectOrArrayKeys(processedValue, {
|
|
246
246
|
rejectKeys,
|
|
247
247
|
filterKeys,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as castToNumber } from "./castValues-
|
|
2
|
-
import { r as clampMax } from "./mathUtils-
|
|
1
|
+
import { t as castToNumber } from "./castValues-BPls1LFT.mjs";
|
|
2
|
+
import { r as clampMax } from "./mathUtils-Cl8qZbfS.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/time.ts
|
|
5
5
|
const MINUTE_AS_MS = 60 * 1e3;
|
package/dist/time.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as MINUTE_AS_MS, c as WEEK_AS_MS, d as YEAR_AS_SECS, f as dateStringOrNullToUnixMs, g as parseTimeStringToMs, h as msToTimeString, i as HOUR_AS_SECS, l as WEEK_AS_SECS, m as getUnixSeconds, n as DAY_AS_SECS, o as MONTH_AS_MS, p as durationObjToMs, r as HOUR_AS_MS, s as MONTH_AS_SECS, t as DAY_AS_MS, u as YEAR_AS_MS } from "./time-
|
|
1
|
+
import { a as MINUTE_AS_MS, c as WEEK_AS_MS, d as YEAR_AS_SECS, f as dateStringOrNullToUnixMs, g as parseTimeStringToMs, h as msToTimeString, i as HOUR_AS_SECS, l as WEEK_AS_SECS, m as getUnixSeconds, n as DAY_AS_SECS, o as MONTH_AS_MS, p as durationObjToMs, r as HOUR_AS_MS, s as MONTH_AS_SECS, t as DAY_AS_MS, u as YEAR_AS_MS } from "./time-BJXm2Xv6.mjs";
|
|
2
2
|
|
|
3
3
|
export { DAY_AS_MS, DAY_AS_SECS, HOUR_AS_MS, HOUR_AS_SECS, MINUTE_AS_MS, MONTH_AS_MS, MONTH_AS_SECS, WEEK_AS_MS, WEEK_AS_SECS, YEAR_AS_MS, YEAR_AS_SECS, dateStringOrNullToUnixMs, durationObjToMs, getUnixSeconds, msToTimeString, parseTimeStringToMs };
|
package/dist/tsResult.mjs
CHANGED
package/dist/typeGuards.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as isPlainObject, i as isObject, n as isFunction, o as isPromise, r as isNonEmptyArray, s as isTruthy, t as arrayHasAtLeastXItems } from "./typeGuards-
|
|
1
|
+
import { a as isPlainObject, i as isObject, n as isFunction, o as isPromise, r as isNonEmptyArray, s as isTruthy, t as arrayHasAtLeastXItems } from "./typeGuards-CSaHQdO9.mjs";
|
|
2
2
|
|
|
3
3
|
export { arrayHasAtLeastXItems, isFunction, isNonEmptyArray, isObject, isPlainObject, isPromise, isTruthy };
|
package/dist/typingFnUtils.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as isObjKey, c as objectHasKey, d as typedObjectEntries, f as typedObjectKeys, i as isNonEmptyArray, l as strictTypedObjectEntries, n as asPartialUndefinedValues, o as isSubTypeOf, p as unionsAreTheSame, r as asType, s as narrowStringToUnion, t as asNonPartial, u as typeOnRightExtendsLeftType } from "./typingFnUtils-
|
|
1
|
+
import { a as isObjKey, c as objectHasKey, d as typedObjectEntries, f as typedObjectKeys, i as isNonEmptyArray, l as strictTypedObjectEntries, n as asPartialUndefinedValues, o as isSubTypeOf, p as unionsAreTheSame, r as asType, s as narrowStringToUnion, t as asNonPartial, u as typeOnRightExtendsLeftType } from "./typingFnUtils-OK4g7kki.mjs";
|
|
2
2
|
|
|
3
3
|
export { asNonPartial, asPartialUndefinedValues, asType, isNonEmptyArray, isObjKey, isSubTypeOf, narrowStringToUnion, objectHasKey, strictTypedObjectEntries, typeOnRightExtendsLeftType, typedObjectEntries, typedObjectKeys, unionsAreTheSame };
|
package/dist/yamlStringify.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as isPlainObject, i as isObject } from "./typeGuards-
|
|
2
|
-
import { C as truncateString } from "./stringUtils-
|
|
3
|
-
import { t as bytesToHumanReadable } from "./conversions-
|
|
1
|
+
import { a as isPlainObject, i as isObject } from "./typeGuards-CSaHQdO9.mjs";
|
|
2
|
+
import { C as truncateString } from "./stringUtils-e-95_mNH.mjs";
|
|
3
|
+
import { t as bytesToHumanReadable } from "./conversions-DAWknpNd.mjs";
|
|
4
4
|
|
|
5
5
|
//#region src/yamlStringify.ts
|
|
6
6
|
function yamlStringify(obj, { maxLineLength = 100, showUndefined, maxDepth = 50, collapseObjects = false, addRootObjSpaces = "beforeAndAfter" } = {}) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ls-stack/utils",
|
|
3
3
|
"description": "Universal TypeScript utilities for browser and Node.js",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.69.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist",
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"./enhancedMap": "./dist/enhancedMap.mjs",
|
|
36
36
|
"./exhaustiveMatch": "./dist/exhaustiveMatch.mjs",
|
|
37
37
|
"./filterObjectOrArrayKeys": "./dist/filterObjectOrArrayKeys.mjs",
|
|
38
|
+
"./fuzzySearch": "./dist/fuzzySearch.mjs",
|
|
38
39
|
"./getAutoIncrementId": "./dist/getAutoIncrementId.mjs",
|
|
39
40
|
"./getCompositeKey": "./dist/getCompositeKey.mjs",
|
|
40
41
|
"./getValueStableKey": "./dist/getValueStableKey.mjs",
|
|
@@ -47,6 +48,7 @@
|
|
|
47
48
|
"./levenshtein": "./dist/levenshtein.mjs",
|
|
48
49
|
"./matchPath": "./dist/matchPath.mjs",
|
|
49
50
|
"./mathUtils": "./dist/mathUtils.mjs",
|
|
51
|
+
"./mockList": "./dist/mockList.mjs",
|
|
50
52
|
"./mutationUtils": "./dist/mutationUtils.mjs",
|
|
51
53
|
"./objUtils": "./dist/objUtils.mjs",
|
|
52
54
|
"./parallelAsyncCalls": "./dist/parallelAsyncCalls.mjs",
|
|
@@ -95,8 +97,8 @@
|
|
|
95
97
|
"mitata": "^1.0.32",
|
|
96
98
|
"prettier": "3.4.2",
|
|
97
99
|
"prettier-plugin-organize-imports": "^4.1.0",
|
|
98
|
-
"tsm": "^2.3.0",
|
|
99
100
|
"tsdown": "^0.18.2",
|
|
101
|
+
"tsm": "^2.3.0",
|
|
100
102
|
"typedoc": "^0.28.4",
|
|
101
103
|
"typedoc-plugin-markdown": "^4.6.3",
|
|
102
104
|
"typedoc-plugin-missing-exports": "^4.0.0",
|
|
@@ -106,6 +108,7 @@
|
|
|
106
108
|
"vitest": "^3.0.4"
|
|
107
109
|
},
|
|
108
110
|
"dependencies": {
|
|
111
|
+
"@leeoniya/ufuzzy": "^1.0.19",
|
|
109
112
|
"evtmitter": "^1.0.2",
|
|
110
113
|
"t-result": "^0.6.1"
|
|
111
114
|
},
|
|
@@ -120,6 +123,7 @@
|
|
|
120
123
|
"build": "tsdown",
|
|
121
124
|
"bench:deepEqual": "tsm --no-warnings benchmarks/deepEqual.ts",
|
|
122
125
|
"docs": "typedoc",
|
|
123
|
-
"docs:watch": "typedoc --watch"
|
|
126
|
+
"docs:watch": "typedoc --watch",
|
|
127
|
+
"update-exports": "node ../../scripts/updatePackageExports.ts"
|
|
124
128
|
}
|
|
125
129
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|