es-toolkit 1.49.0 → 1.50.0-dev.1975
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/CHANGELOG.md +46 -0
- package/dist/array/partition.d.mts +5 -4
- package/dist/array/partition.d.ts +5 -4
- package/dist/array/unzipWith.js +1 -1
- package/dist/array/unzipWith.mjs +1 -1
- package/dist/browser.global.js +3 -3
- package/dist/compat/_internal/ListIterateeCustom.d.mts +3 -2
- package/dist/compat/_internal/ListIterateeCustom.d.ts +3 -2
- package/dist/compat/_internal/assignValue.js +2 -3
- package/dist/compat/_internal/assignValue.mjs +2 -3
- package/dist/compat/_internal/createPadding.js +14 -0
- package/dist/compat/_internal/createPadding.mjs +13 -0
- package/dist/compat/_internal/isDeepKey.js +14 -1
- package/dist/compat/_internal/isDeepKey.mjs +14 -1
- package/dist/compat/_internal/isIterateeCall.js +2 -3
- package/dist/compat/_internal/isIterateeCall.mjs +2 -3
- package/dist/compat/_internal/regexMultiByte.js +11 -0
- package/dist/compat/_internal/regexMultiByte.mjs +11 -0
- package/dist/compat/array/every.js +5 -24
- package/dist/compat/array/every.mjs +5 -24
- package/dist/compat/array/filter.d.mts +7 -3
- package/dist/compat/array/filter.d.ts +7 -3
- package/dist/compat/array/filter.js +11 -11
- package/dist/compat/array/filter.mjs +11 -11
- package/dist/compat/array/find.d.mts +10 -6
- package/dist/compat/array/find.d.ts +10 -6
- package/dist/compat/array/find.js +1 -1
- package/dist/compat/array/find.mjs +1 -1
- package/dist/compat/array/findIndex.d.mts +0 -1
- package/dist/compat/array/findIndex.d.ts +0 -1
- package/dist/compat/array/findIndex.js +2 -1
- package/dist/compat/array/findIndex.mjs +2 -1
- package/dist/compat/array/findLast.d.mts +1 -1
- package/dist/compat/array/findLast.d.ts +1 -1
- package/dist/compat/array/findLast.js +12 -12
- package/dist/compat/array/findLast.mjs +12 -12
- package/dist/compat/array/findLastIndex.js +1 -0
- package/dist/compat/array/findLastIndex.mjs +1 -0
- package/dist/compat/array/flatMap.js +3 -2
- package/dist/compat/array/flatMap.mjs +3 -2
- package/dist/compat/array/flatMapDepth.js +2 -2
- package/dist/compat/array/flatMapDepth.mjs +2 -2
- package/dist/compat/array/flatten.d.mts +4 -5
- package/dist/compat/array/flatten.d.ts +4 -5
- package/dist/compat/array/flatten.js +14 -15
- package/dist/compat/array/flatten.mjs +14 -15
- package/dist/compat/array/flattenDeep.d.mts +1 -1
- package/dist/compat/array/flattenDeep.d.ts +1 -1
- package/dist/compat/array/flattenDeep.js +2 -2
- package/dist/compat/array/flattenDeep.mjs +2 -2
- package/dist/compat/array/flattenDepth.js +18 -2
- package/dist/compat/array/flattenDepth.mjs +18 -2
- package/dist/compat/array/groupBy.js +5 -4
- package/dist/compat/array/groupBy.mjs +4 -3
- package/dist/compat/array/includes.js +8 -3
- package/dist/compat/array/includes.mjs +8 -3
- package/dist/compat/array/intersectionBy.js +12 -5
- package/dist/compat/array/intersectionBy.mjs +12 -5
- package/dist/compat/array/intersectionWith.js +2 -3
- package/dist/compat/array/intersectionWith.mjs +2 -3
- package/dist/compat/array/invokeMap.js +3 -7
- package/dist/compat/array/invokeMap.mjs +3 -4
- package/dist/compat/array/lastIndexOf.js +3 -2
- package/dist/compat/array/lastIndexOf.mjs +3 -2
- package/dist/compat/array/nth.js +2 -2
- package/dist/compat/array/nth.mjs +2 -2
- package/dist/compat/array/pullAllWith.js +2 -3
- package/dist/compat/array/pullAllWith.mjs +2 -3
- package/dist/compat/array/size.js +2 -0
- package/dist/compat/array/size.mjs +2 -0
- package/dist/compat/array/sortedIndexOf.js +2 -3
- package/dist/compat/array/sortedIndexOf.mjs +2 -3
- package/dist/compat/array/sortedLastIndexOf.js +2 -3
- package/dist/compat/array/sortedLastIndexOf.mjs +2 -3
- package/dist/compat/compat.d.mts +4 -3
- package/dist/compat/compat.d.ts +4 -3
- package/dist/compat/compat.js +10 -11
- package/dist/compat/compat.mjs +10 -11
- package/dist/compat/index.d.mts +4 -3
- package/dist/compat/index.d.ts +4 -3
- package/dist/compat/index.js +10 -9
- package/dist/compat/index.mjs +10 -9
- package/dist/compat/math/inRange.d.mts +5 -2
- package/dist/compat/math/inRange.d.ts +5 -2
- package/dist/compat/math/inRange.js +14 -11
- package/dist/compat/math/inRange.mjs +14 -11
- package/dist/compat/math/maxBy.d.mts +1 -1
- package/dist/compat/math/maxBy.d.ts +1 -1
- package/dist/compat/math/maxBy.js +18 -4
- package/dist/compat/math/maxBy.mjs +18 -4
- package/dist/compat/math/minBy.d.mts +1 -1
- package/dist/compat/math/minBy.d.ts +1 -1
- package/dist/compat/math/minBy.js +18 -4
- package/dist/compat/math/minBy.mjs +18 -4
- package/dist/compat/object/assign.js +2 -3
- package/dist/compat/object/assign.mjs +2 -3
- package/dist/compat/object/assignIn.js +2 -3
- package/dist/compat/object/assignIn.mjs +2 -3
- package/dist/compat/object/assignInWith.js +2 -3
- package/dist/compat/object/assignInWith.mjs +2 -3
- package/dist/compat/object/assignWith.js +2 -3
- package/dist/compat/object/assignWith.mjs +2 -3
- package/dist/compat/object/create.js +1 -1
- package/dist/compat/object/create.mjs +1 -1
- package/dist/compat/object/defaults.js +2 -3
- package/dist/compat/object/defaults.mjs +2 -3
- package/dist/compat/object/has.js +1 -1
- package/dist/compat/object/has.mjs +1 -1
- package/dist/compat/object/hasIn.js +1 -1
- package/dist/compat/object/hasIn.mjs +1 -1
- package/dist/compat/object/unset.js +1 -1
- package/dist/compat/object/unset.mjs +1 -1
- package/dist/compat/object/values.js +5 -1
- package/dist/compat/object/values.mjs +5 -1
- package/dist/compat/predicate/isMatchWith.js +4 -5
- package/dist/compat/predicate/isMatchWith.mjs +4 -5
- package/dist/compat/string/camelCase.js +6 -2
- package/dist/compat/string/camelCase.mjs +6 -2
- package/dist/compat/string/kebabCase.js +2 -2
- package/dist/compat/string/kebabCase.mjs +2 -2
- package/dist/compat/string/lowerCase.js +2 -2
- package/dist/compat/string/lowerCase.mjs +2 -2
- package/dist/compat/string/pad.js +10 -3
- package/dist/compat/string/pad.mjs +10 -3
- package/dist/compat/string/padEnd.js +7 -1
- package/dist/compat/string/padEnd.mjs +7 -1
- package/dist/compat/string/padStart.js +7 -1
- package/dist/compat/string/padStart.mjs +7 -1
- package/dist/compat/string/snakeCase.js +2 -2
- package/dist/compat/string/snakeCase.mjs +2 -2
- package/dist/compat/string/startCase.js +1 -1
- package/dist/compat/string/startCase.mjs +1 -1
- package/dist/compat/string/template.d.mts +1 -1
- package/dist/compat/string/template.d.ts +1 -1
- package/dist/compat/string/templateSettings.d.mts +18 -1
- package/dist/compat/string/templateSettings.d.ts +18 -1
- package/dist/compat/string/templateSettings.js +4 -1
- package/dist/compat/string/templateSettings.mjs +5 -1
- package/dist/compat/string/truncate.js +2 -9
- package/dist/compat/string/truncate.mjs +1 -8
- package/dist/compat/string/upperCase.js +2 -2
- package/dist/compat/string/upperCase.mjs +2 -2
- package/dist/compat/util/eq.d.mts +17 -1
- package/dist/compat/util/eq.d.ts +17 -1
- package/dist/compat/util/eq.js +19 -1
- package/dist/compat/util/eq.mjs +19 -1
- package/dist/compat/util/toArray.js +2 -1
- package/dist/compat/util/toArray.mjs +2 -1
- package/dist/fp/flow.d.mts +213 -0
- package/dist/fp/flow.d.ts +213 -0
- package/dist/fp/flow.js +50 -0
- package/dist/fp/flow.mjs +50 -0
- package/dist/fp/index.d.mts +2 -1
- package/dist/fp/index.d.ts +2 -1
- package/dist/fp/index.js +3 -1
- package/dist/fp/index.mjs +3 -2
- package/dist/fp/pipe.js +8 -12
- package/dist/fp/pipe.mjs +8 -12
- package/dist/map/hasValue.js +2 -2
- package/dist/map/hasValue.mjs +2 -2
- package/dist/predicate/isEqualWith.js +2 -3
- package/dist/predicate/isEqualWith.mjs +2 -3
- package/dist/string/deburr.js +1 -1
- package/dist/string/deburr.mjs +1 -1
- package/dist/types/DeepPartial.d.mts +21 -0
- package/dist/types/DeepPartial.d.ts +21 -0
- package/dist/types/DeepReadonly.d.mts +22 -0
- package/dist/types/DeepReadonly.d.ts +22 -0
- package/dist/types/NonEmptyArray.d.mts +14 -0
- package/dist/types/NonEmptyArray.d.ts +14 -0
- package/dist/types/Simplify.d.mts +18 -0
- package/dist/types/Simplify.d.ts +18 -0
- package/dist/types/ValueOf.d.mts +14 -0
- package/dist/types/ValueOf.d.ts +14 -0
- package/dist/types/Writable.d.mts +15 -0
- package/dist/types/Writable.d.ts +15 -0
- package/dist/types/index.d.mts +7 -0
- package/dist/types/index.d.ts +7 -0
- package/package.json +23 -7
- package/types.d.ts +1 -0
- package/dist/_internal/isEqualsSameValueZero.d.mts +0 -17
- package/dist/_internal/isEqualsSameValueZero.d.ts +0 -17
- package/dist/_internal/isEqualsSameValueZero.js +0 -19
- package/dist/_internal/isEqualsSameValueZero.mjs +0 -19
package/dist/fp/flow.mjs
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { pipe } from "./pipe.mjs";
|
|
2
|
+
//#region src/fp/flow.ts
|
|
3
|
+
/**
|
|
4
|
+
* Performs left-to-right function composition, returning a **reusable function**
|
|
5
|
+
* instead of running immediately. The first function may take any number of
|
|
6
|
+
* arguments; every later function is unary and receives the previous result.
|
|
7
|
+
*
|
|
8
|
+
* `flow` is the deferred sibling of {@link pipe}: where `pipe(value, ...fns)`
|
|
9
|
+
* threads a concrete value through the functions right away, `flow(...fns)`
|
|
10
|
+
* builds a function you can call later (and reuse) with the data. Internally it
|
|
11
|
+
* delegates to `pipe`, so lazy-capable functions (`map`, `filter`, `take`, …)
|
|
12
|
+
* are fused exactly the same way and benefit from early termination.
|
|
13
|
+
*
|
|
14
|
+
* @param functions - The functions to compose. The first may be variadic; the
|
|
15
|
+
* rest are unary, each receiving the previous function's output.
|
|
16
|
+
* @returns A function that, when called, applies every function left-to-right.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* import { flow } from 'es-toolkit/fp';
|
|
20
|
+
*
|
|
21
|
+
* const addThenSquare = flow(
|
|
22
|
+
* (x: number, y: number) => x + y,
|
|
23
|
+
* n => n * n
|
|
24
|
+
* );
|
|
25
|
+
*
|
|
26
|
+
* addThenSquare(1, 2); // => 9
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* import { flow, map, filter, take } from 'es-toolkit/fp';
|
|
30
|
+
*
|
|
31
|
+
* // A reusable lazy pipeline. Only the first two even squares are computed.
|
|
32
|
+
* const firstTwoEvenSquares = flow(
|
|
33
|
+
* map((x: number) => x * x),
|
|
34
|
+
* filter(x => x % 2 === 0),
|
|
35
|
+
* take(2)
|
|
36
|
+
* );
|
|
37
|
+
*
|
|
38
|
+
* firstTwoEvenSquares([1, 2, 3, 4, 5, 6, 7, 8]); // => [4, 16]
|
|
39
|
+
*/
|
|
40
|
+
function flow(...functions) {
|
|
41
|
+
const run = pipe;
|
|
42
|
+
return function(...args) {
|
|
43
|
+
if (functions.length === 0) return args[0];
|
|
44
|
+
if (args.length <= 1) return run(args[0], ...functions);
|
|
45
|
+
const [first, ...rest] = functions;
|
|
46
|
+
return run(first.apply(this, args), ...rest);
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
//#endregion
|
|
50
|
+
export { flow };
|
package/dist/fp/index.d.mts
CHANGED
|
@@ -67,9 +67,10 @@ import { xorWith } from "./array/xorWith.mjs";
|
|
|
67
67
|
import { zip } from "./array/zip.mjs";
|
|
68
68
|
import { zipObject } from "./array/zipObject.mjs";
|
|
69
69
|
import { zipWith } from "./array/zipWith.mjs";
|
|
70
|
+
import { flow } from "./flow.mjs";
|
|
70
71
|
import { add } from "./math/add.mjs";
|
|
71
72
|
import { multiply } from "./math/multiply.mjs";
|
|
72
73
|
import { omit } from "./object/omit.mjs";
|
|
73
74
|
import { pick } from "./object/pick.mjs";
|
|
74
75
|
import { pipe } from "./pipe.mjs";
|
|
75
|
-
export { WindowedOptions, add, at, cartesianProduct, chunk, chunkBy, combinations, compact, countBy, difference, differenceBy, differenceWith, drop, dropRight, dropRightWhile, dropWhile, filter, find, findIndex, findLast, findLastIndex, flatMap, flatMapDeep, flatten, flattenDeep, forEach, groupBy, head, initial, intersection, intersectionBy, intersectionWith, isSubset, isSubsetWith, join, keyBy, last, length, map, maxBy, minBy, multiply, omit, orderBy, partition, pick, pipe, reverse, sample, sampleSize, shuffle, sortBy, tail, take, takeRight, takeRightWhile, takeWhile, toFilled, union, unionBy, unionWith, uniq, uniqBy, uniqWith, unzip, unzipWith, windowed, without, xor, xorBy, xorWith, zip, zipObject, zipWith };
|
|
76
|
+
export { WindowedOptions, add, at, cartesianProduct, chunk, chunkBy, combinations, compact, countBy, difference, differenceBy, differenceWith, drop, dropRight, dropRightWhile, dropWhile, filter, find, findIndex, findLast, findLastIndex, flatMap, flatMapDeep, flatten, flattenDeep, flow, forEach, groupBy, head, initial, intersection, intersectionBy, intersectionWith, isSubset, isSubsetWith, join, keyBy, last, length, map, maxBy, minBy, multiply, omit, orderBy, partition, pick, pipe, reverse, sample, sampleSize, shuffle, sortBy, tail, take, takeRight, takeRightWhile, takeWhile, toFilled, union, unionBy, unionWith, uniq, uniqBy, uniqWith, unzip, unzipWith, windowed, without, xor, xorBy, xorWith, zip, zipObject, zipWith };
|
package/dist/fp/index.d.ts
CHANGED
|
@@ -67,9 +67,10 @@ import { xorWith } from "./array/xorWith.js";
|
|
|
67
67
|
import { zip } from "./array/zip.js";
|
|
68
68
|
import { zipObject } from "./array/zipObject.js";
|
|
69
69
|
import { zipWith } from "./array/zipWith.js";
|
|
70
|
+
import { flow } from "./flow.js";
|
|
70
71
|
import { add } from "./math/add.js";
|
|
71
72
|
import { multiply } from "./math/multiply.js";
|
|
72
73
|
import { omit } from "./object/omit.js";
|
|
73
74
|
import { pick } from "./object/pick.js";
|
|
74
75
|
import { pipe } from "./pipe.js";
|
|
75
|
-
export { WindowedOptions, add, at, cartesianProduct, chunk, chunkBy, combinations, compact, countBy, difference, differenceBy, differenceWith, drop, dropRight, dropRightWhile, dropWhile, filter, find, findIndex, findLast, findLastIndex, flatMap, flatMapDeep, flatten, flattenDeep, forEach, groupBy, head, initial, intersection, intersectionBy, intersectionWith, isSubset, isSubsetWith, join, keyBy, last, length, map, maxBy, minBy, multiply, omit, orderBy, partition, pick, pipe, reverse, sample, sampleSize, shuffle, sortBy, tail, take, takeRight, takeRightWhile, takeWhile, toFilled, union, unionBy, unionWith, uniq, uniqBy, uniqWith, unzip, unzipWith, windowed, without, xor, xorBy, xorWith, zip, zipObject, zipWith };
|
|
76
|
+
export { WindowedOptions, add, at, cartesianProduct, chunk, chunkBy, combinations, compact, countBy, difference, differenceBy, differenceWith, drop, dropRight, dropRightWhile, dropWhile, filter, find, findIndex, findLast, findLastIndex, flatMap, flatMapDeep, flatten, flattenDeep, flow, forEach, groupBy, head, initial, intersection, intersectionBy, intersectionWith, isSubset, isSubsetWith, join, keyBy, last, length, map, maxBy, minBy, multiply, omit, orderBy, partition, pick, pipe, reverse, sample, sampleSize, shuffle, sortBy, tail, take, takeRight, takeRightWhile, takeWhile, toFilled, union, unionBy, unionWith, uniq, uniqBy, uniqWith, unzip, unzipWith, windowed, without, xor, xorBy, xorWith, zip, zipObject, zipWith };
|
package/dist/fp/index.js
CHANGED
|
@@ -68,13 +68,14 @@ const require_zip = require("./array/zip.js");
|
|
|
68
68
|
const require_zipObject = require("./array/zipObject.js");
|
|
69
69
|
const require_zipWith = require("./array/zipWith.js");
|
|
70
70
|
require("./array/index.js");
|
|
71
|
+
const require_pipe = require("./pipe.js");
|
|
72
|
+
const require_flow = require("./flow.js");
|
|
71
73
|
const require_add = require("./math/add.js");
|
|
72
74
|
const require_multiply = require("./math/multiply.js");
|
|
73
75
|
require("./math/index.js");
|
|
74
76
|
const require_omit = require("./object/omit.js");
|
|
75
77
|
const require_pick = require("./object/pick.js");
|
|
76
78
|
require("./object/index.js");
|
|
77
|
-
const require_pipe = require("./pipe.js");
|
|
78
79
|
exports.add = require_add.add;
|
|
79
80
|
exports.at = require_at.at;
|
|
80
81
|
exports.cartesianProduct = require_cartesianProduct.cartesianProduct;
|
|
@@ -99,6 +100,7 @@ exports.flatMap = require_flatMap.flatMap;
|
|
|
99
100
|
exports.flatMapDeep = require_flatMapDeep.flatMapDeep;
|
|
100
101
|
exports.flatten = require_flatten.flatten;
|
|
101
102
|
exports.flattenDeep = require_flattenDeep.flattenDeep;
|
|
103
|
+
exports.flow = require_flow.flow;
|
|
102
104
|
exports.forEach = require_forEach.forEach;
|
|
103
105
|
exports.groupBy = require_groupBy.groupBy;
|
|
104
106
|
exports.head = require_head.head;
|
package/dist/fp/index.mjs
CHANGED
|
@@ -67,11 +67,12 @@ import { zip } from "./array/zip.mjs";
|
|
|
67
67
|
import { zipObject } from "./array/zipObject.mjs";
|
|
68
68
|
import { zipWith } from "./array/zipWith.mjs";
|
|
69
69
|
import "./array/index.mjs";
|
|
70
|
+
import { pipe } from "./pipe.mjs";
|
|
71
|
+
import { flow } from "./flow.mjs";
|
|
70
72
|
import { add } from "./math/add.mjs";
|
|
71
73
|
import { multiply } from "./math/multiply.mjs";
|
|
72
74
|
import "./math/index.mjs";
|
|
73
75
|
import { omit } from "./object/omit.mjs";
|
|
74
76
|
import { pick } from "./object/pick.mjs";
|
|
75
77
|
import "./object/index.mjs";
|
|
76
|
-
|
|
77
|
-
export { add, at, cartesianProduct, chunk, chunkBy, combinations, compact, countBy, difference, differenceBy, differenceWith, drop, dropRight, dropRightWhile, dropWhile, filter, find, findIndex, findLast, findLastIndex, flatMap, flatMapDeep, flatten, flattenDeep, forEach, groupBy, head, initial, intersection, intersectionBy, intersectionWith, isSubset, isSubsetWith, join, keyBy, last, length, map, maxBy, minBy, multiply, omit, orderBy, partition, pick, pipe, reverse, sample, sampleSize, shuffle, sortBy, tail, take, takeRight, takeRightWhile, takeWhile, toFilled, union, unionBy, unionWith, uniq, uniqBy, uniqWith, unzip, unzipWith, windowed, without, xor, xorBy, xorWith, zip, zipObject, zipWith };
|
|
78
|
+
export { add, at, cartesianProduct, chunk, chunkBy, combinations, compact, countBy, difference, differenceBy, differenceWith, drop, dropRight, dropRightWhile, dropWhile, filter, find, findIndex, findLast, findLastIndex, flatMap, flatMapDeep, flatten, flattenDeep, flow, forEach, groupBy, head, initial, intersection, intersectionBy, intersectionWith, isSubset, isSubsetWith, join, keyBy, last, length, map, maxBy, minBy, multiply, omit, orderBy, partition, pick, pipe, reverse, sample, sampleSize, shuffle, sortBy, tail, take, takeRight, takeRightWhile, takeWhile, toFilled, union, unionBy, unionWith, uniq, uniqBy, uniqWith, unzip, unzipWith, windowed, without, xor, xorBy, xorWith, zip, zipObject, zipWith };
|
package/dist/fp/pipe.js
CHANGED
|
@@ -54,22 +54,18 @@ function pipe(value, ...functions) {
|
|
|
54
54
|
return output;
|
|
55
55
|
}
|
|
56
56
|
function chunkFunctions(functions) {
|
|
57
|
-
|
|
58
|
-
let currentGroup
|
|
59
|
-
|
|
60
|
-
let previousIsLazy = currentGroup[0].lazy != null;
|
|
61
|
-
if (previousIsLazy) currentGroup.lazy = true;
|
|
62
|
-
if (currentGroup[0].shortCircuit) currentGroup.shortCircuit = true;
|
|
63
|
-
for (let index = 1; index < functions.length; index++) {
|
|
57
|
+
const result = [];
|
|
58
|
+
let currentGroup;
|
|
59
|
+
for (let index = 0; index < functions.length; index++) {
|
|
64
60
|
const func = functions[index];
|
|
65
61
|
const isLazy = func.lazy != null;
|
|
66
|
-
if (
|
|
67
|
-
currentGroup = [
|
|
62
|
+
if (currentGroup === void 0 || currentGroup.lazy !== isLazy) {
|
|
63
|
+
currentGroup = [];
|
|
64
|
+
currentGroup.lazy = isLazy;
|
|
68
65
|
result.push(currentGroup);
|
|
69
|
-
}
|
|
70
|
-
|
|
66
|
+
}
|
|
67
|
+
currentGroup.push(func);
|
|
71
68
|
if (func.shortCircuit) currentGroup.shortCircuit = true;
|
|
72
|
-
previousIsLazy = isLazy;
|
|
73
69
|
}
|
|
74
70
|
return result;
|
|
75
71
|
}
|
package/dist/fp/pipe.mjs
CHANGED
|
@@ -54,22 +54,18 @@ function pipe(value, ...functions) {
|
|
|
54
54
|
return output;
|
|
55
55
|
}
|
|
56
56
|
function chunkFunctions(functions) {
|
|
57
|
-
|
|
58
|
-
let currentGroup
|
|
59
|
-
|
|
60
|
-
let previousIsLazy = currentGroup[0].lazy != null;
|
|
61
|
-
if (previousIsLazy) currentGroup.lazy = true;
|
|
62
|
-
if (currentGroup[0].shortCircuit) currentGroup.shortCircuit = true;
|
|
63
|
-
for (let index = 1; index < functions.length; index++) {
|
|
57
|
+
const result = [];
|
|
58
|
+
let currentGroup;
|
|
59
|
+
for (let index = 0; index < functions.length; index++) {
|
|
64
60
|
const func = functions[index];
|
|
65
61
|
const isLazy = func.lazy != null;
|
|
66
|
-
if (
|
|
67
|
-
currentGroup = [
|
|
62
|
+
if (currentGroup === void 0 || currentGroup.lazy !== isLazy) {
|
|
63
|
+
currentGroup = [];
|
|
64
|
+
currentGroup.lazy = isLazy;
|
|
68
65
|
result.push(currentGroup);
|
|
69
|
-
}
|
|
70
|
-
|
|
66
|
+
}
|
|
67
|
+
currentGroup.push(func);
|
|
71
68
|
if (func.shortCircuit) currentGroup.shortCircuit = true;
|
|
72
|
-
previousIsLazy = isLazy;
|
|
73
69
|
}
|
|
74
70
|
return result;
|
|
75
71
|
}
|
package/dist/map/hasValue.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_eq = require("../compat/util/eq.js");
|
|
2
2
|
//#region src/map/hasValue.ts
|
|
3
3
|
/**
|
|
4
4
|
* Checks if a Map contains a specific value.
|
|
@@ -26,7 +26,7 @@ const require_isEqualsSameValueZero = require("../_internal/isEqualsSameValueZer
|
|
|
26
26
|
* // result2 will be: false
|
|
27
27
|
*/
|
|
28
28
|
function hasValue(map, searchElement) {
|
|
29
|
-
for (const value of map.values()) if (
|
|
29
|
+
for (const value of map.values()) if (require_eq.eq(value, searchElement)) return true;
|
|
30
30
|
return false;
|
|
31
31
|
}
|
|
32
32
|
//#endregion
|
package/dist/map/hasValue.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { eq } from "../compat/util/eq.mjs";
|
|
2
2
|
//#region src/map/hasValue.ts
|
|
3
3
|
/**
|
|
4
4
|
* Checks if a Map contains a specific value.
|
|
@@ -26,7 +26,7 @@ import { isEqualsSameValueZero } from "../_internal/isEqualsSameValueZero.mjs";
|
|
|
26
26
|
* // result2 will be: false
|
|
27
27
|
*/
|
|
28
28
|
function hasValue(map, searchElement) {
|
|
29
|
-
for (const value of map.values()) if (
|
|
29
|
+
for (const value of map.values()) if (eq(value, searchElement)) return true;
|
|
30
30
|
return false;
|
|
31
31
|
}
|
|
32
32
|
//#endregion
|
|
@@ -3,8 +3,7 @@ const require_getTag = require("../compat/_internal/getTag.js");
|
|
|
3
3
|
const require_tags = require("../compat/_internal/tags.js");
|
|
4
4
|
const require_isBuffer = require("./isBuffer.js");
|
|
5
5
|
const require_isPlainObject = require("./isPlainObject.js");
|
|
6
|
-
const
|
|
7
|
-
require("../compat/util/eq.js");
|
|
6
|
+
const require_eq = require("../compat/util/eq.js");
|
|
8
7
|
//#region src/predicate/isEqualWith.ts
|
|
9
8
|
/**
|
|
10
9
|
* Compares two values for equality using a custom comparison function.
|
|
@@ -71,7 +70,7 @@ function areObjectsEqual(a, b, stack, areValuesEqual) {
|
|
|
71
70
|
case require_tags.numberTag: {
|
|
72
71
|
const x = a.valueOf();
|
|
73
72
|
const y = b.valueOf();
|
|
74
|
-
return
|
|
73
|
+
return require_eq.eq(x, y);
|
|
75
74
|
}
|
|
76
75
|
case require_tags.booleanTag:
|
|
77
76
|
case require_tags.dateTag:
|
|
@@ -3,8 +3,7 @@ import { getTag } from "../compat/_internal/getTag.mjs";
|
|
|
3
3
|
import { arrayBufferTag, arrayTag, bigInt64ArrayTag, bigUint64ArrayTag, booleanTag, dataViewTag, dateTag, errorTag, float32ArrayTag, float64ArrayTag, functionTag, int16ArrayTag, int32ArrayTag, int8ArrayTag, mapTag, numberTag, objectTag, regexpTag, setTag, stringTag, symbolTag, uint16ArrayTag, uint32ArrayTag, uint8ArrayTag, uint8ClampedArrayTag } from "../compat/_internal/tags.mjs";
|
|
4
4
|
import { isBuffer } from "./isBuffer.mjs";
|
|
5
5
|
import { isPlainObject } from "./isPlainObject.mjs";
|
|
6
|
-
import {
|
|
7
|
-
import "../compat/util/eq.mjs";
|
|
6
|
+
import { eq } from "../compat/util/eq.mjs";
|
|
8
7
|
//#region src/predicate/isEqualWith.ts
|
|
9
8
|
/**
|
|
10
9
|
* Compares two values for equality using a custom comparison function.
|
|
@@ -68,7 +67,7 @@ function areObjectsEqual(a, b, stack, areValuesEqual) {
|
|
|
68
67
|
if (aTag !== bTag) return false;
|
|
69
68
|
switch (aTag) {
|
|
70
69
|
case stringTag: return a.toString() === b.toString();
|
|
71
|
-
case numberTag: return
|
|
70
|
+
case numberTag: return eq(a.valueOf(), b.valueOf());
|
|
72
71
|
case booleanTag:
|
|
73
72
|
case dateTag:
|
|
74
73
|
case symbolTag: return Object.is(a.valueOf(), b.valueOf());
|
package/dist/string/deburr.js
CHANGED
|
@@ -54,7 +54,7 @@ function deburr(str) {
|
|
|
54
54
|
let result = "";
|
|
55
55
|
for (let i = 0; i < str.length; i++) {
|
|
56
56
|
const char = str[i];
|
|
57
|
-
if (char >= "̀" && char <= "ͯ" || char >= "︠" && char <= "
|
|
57
|
+
if (char >= "̀" && char <= "ͯ" || char >= "⃐" && char <= "" || char >= "︠" && char <= "︯") continue;
|
|
58
58
|
result += deburrMap.get(char) ?? char;
|
|
59
59
|
}
|
|
60
60
|
return result;
|
package/dist/string/deburr.mjs
CHANGED
|
@@ -54,7 +54,7 @@ function deburr(str) {
|
|
|
54
54
|
let result = "";
|
|
55
55
|
for (let i = 0; i < str.length; i++) {
|
|
56
56
|
const char = str[i];
|
|
57
|
-
if (char >= "̀" && char <= "ͯ" || char >= "︠" && char <= "
|
|
57
|
+
if (char >= "̀" && char <= "ͯ" || char >= "⃐" && char <= "" || char >= "︠" && char <= "︯") continue;
|
|
58
58
|
result += deburrMap.get(char) ?? char;
|
|
59
59
|
}
|
|
60
60
|
return result;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//#region src/types/DeepPartial.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Makes all properties of `T` optional recursively, unlike the built-in
|
|
4
|
+
* `Partial` which only affects the first level.
|
|
5
|
+
*
|
|
6
|
+
* Recurses into plain objects, arrays/tuples (elements do not become sparse),
|
|
7
|
+
* and `Map`/`Set` contents. Functions, `Date`, and `RegExp` pass through
|
|
8
|
+
* unchanged.
|
|
9
|
+
*
|
|
10
|
+
* @template T - The type to make deeply optional.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* type Config = { server: { host: string; port: number }; debug: boolean };
|
|
14
|
+
* type ConfigPatch = DeepPartial<Config>;
|
|
15
|
+
* // => { server?: { host?: string; port?: number }; debug?: boolean }
|
|
16
|
+
*
|
|
17
|
+
* const patch: ConfigPatch = { server: { port: 8080 } }; // ok, host omitted
|
|
18
|
+
*/
|
|
19
|
+
type DeepPartial<T> = T extends ((...args: any[]) => unknown) | Date | RegExp ? T : T extends Map<infer K, infer V> ? Map<DeepPartial<K>, DeepPartial<V>> : T extends ReadonlyMap<infer K, infer V> ? ReadonlyMap<DeepPartial<K>, DeepPartial<V>> : T extends Set<infer U> ? Set<DeepPartial<U>> : T extends ReadonlySet<infer U> ? ReadonlySet<DeepPartial<U>> : T extends readonly unknown[] ? { [K in keyof T]: DeepPartial<T[K]> } : T extends object ? { [K in keyof T]?: DeepPartial<T[K]> } : T;
|
|
20
|
+
//#endregion
|
|
21
|
+
export { DeepPartial };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//#region src/types/DeepPartial.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Makes all properties of `T` optional recursively, unlike the built-in
|
|
4
|
+
* `Partial` which only affects the first level.
|
|
5
|
+
*
|
|
6
|
+
* Recurses into plain objects, arrays/tuples (elements do not become sparse),
|
|
7
|
+
* and `Map`/`Set` contents. Functions, `Date`, and `RegExp` pass through
|
|
8
|
+
* unchanged.
|
|
9
|
+
*
|
|
10
|
+
* @template T - The type to make deeply optional.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* type Config = { server: { host: string; port: number }; debug: boolean };
|
|
14
|
+
* type ConfigPatch = DeepPartial<Config>;
|
|
15
|
+
* // => { server?: { host?: string; port?: number }; debug?: boolean }
|
|
16
|
+
*
|
|
17
|
+
* const patch: ConfigPatch = { server: { port: 8080 } }; // ok, host omitted
|
|
18
|
+
*/
|
|
19
|
+
type DeepPartial<T> = T extends ((...args: any[]) => unknown) | Date | RegExp ? T : T extends Map<infer K, infer V> ? Map<DeepPartial<K>, DeepPartial<V>> : T extends ReadonlyMap<infer K, infer V> ? ReadonlyMap<DeepPartial<K>, DeepPartial<V>> : T extends Set<infer U> ? Set<DeepPartial<U>> : T extends ReadonlySet<infer U> ? ReadonlySet<DeepPartial<U>> : T extends readonly unknown[] ? { [K in keyof T]: DeepPartial<T[K]> } : T extends object ? { [K in keyof T]?: DeepPartial<T[K]> } : T;
|
|
20
|
+
//#endregion
|
|
21
|
+
export { DeepPartial };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
//#region src/types/DeepReadonly.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Makes all properties of `T` readonly recursively, unlike the built-in
|
|
4
|
+
* `Readonly` which only affects the first level.
|
|
5
|
+
*
|
|
6
|
+
* Arrays and tuples become readonly, and `Map`/`Set` become
|
|
7
|
+
* `ReadonlyMap`/`ReadonlySet`. Functions, `Date`, and `RegExp` pass through
|
|
8
|
+
* unchanged.
|
|
9
|
+
*
|
|
10
|
+
* @template T - The type to make deeply readonly.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* type State = { user: { name: string; tags: string[] } };
|
|
14
|
+
* type FrozenState = DeepReadonly<State>;
|
|
15
|
+
* // => { readonly user: { readonly name: string; readonly tags: readonly string[] } }
|
|
16
|
+
*
|
|
17
|
+
* declare const state: FrozenState;
|
|
18
|
+
* state.user.name = 'x'; // error: name is readonly
|
|
19
|
+
*/
|
|
20
|
+
type DeepReadonly<T> = T extends ((...args: any[]) => unknown) | Date | RegExp ? T : T extends ReadonlyMap<infer K, infer V> ? ReadonlyMap<DeepReadonly<K>, DeepReadonly<V>> : T extends ReadonlySet<infer U> ? ReadonlySet<DeepReadonly<U>> : T extends object ? { readonly [K in keyof T]: DeepReadonly<T[K]> } : T;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { DeepReadonly };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
//#region src/types/DeepReadonly.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Makes all properties of `T` readonly recursively, unlike the built-in
|
|
4
|
+
* `Readonly` which only affects the first level.
|
|
5
|
+
*
|
|
6
|
+
* Arrays and tuples become readonly, and `Map`/`Set` become
|
|
7
|
+
* `ReadonlyMap`/`ReadonlySet`. Functions, `Date`, and `RegExp` pass through
|
|
8
|
+
* unchanged.
|
|
9
|
+
*
|
|
10
|
+
* @template T - The type to make deeply readonly.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* type State = { user: { name: string; tags: string[] } };
|
|
14
|
+
* type FrozenState = DeepReadonly<State>;
|
|
15
|
+
* // => { readonly user: { readonly name: string; readonly tags: readonly string[] } }
|
|
16
|
+
*
|
|
17
|
+
* declare const state: FrozenState;
|
|
18
|
+
* state.user.name = 'x'; // error: name is readonly
|
|
19
|
+
*/
|
|
20
|
+
type DeepReadonly<T> = T extends ((...args: any[]) => unknown) | Date | RegExp ? T : T extends ReadonlyMap<infer K, infer V> ? ReadonlyMap<DeepReadonly<K>, DeepReadonly<V>> : T extends ReadonlySet<infer U> ? ReadonlySet<DeepReadonly<U>> : T extends object ? { readonly [K in keyof T]: DeepReadonly<T[K]> } : T;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { DeepReadonly };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region src/types/NonEmptyArray.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* An array guaranteed to have at least one element.
|
|
4
|
+
* The first element resolves to `T` instead of `T | undefined`.
|
|
5
|
+
*
|
|
6
|
+
* @template T - The type of the elements.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* const a: NonEmptyArray<number> = [1, 2, 3]; // ok
|
|
10
|
+
* const b: NonEmptyArray<number> = []; // error: empty array not allowed
|
|
11
|
+
*/
|
|
12
|
+
type NonEmptyArray<T> = [T, ...T[]];
|
|
13
|
+
//#endregion
|
|
14
|
+
export { NonEmptyArray };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region src/types/NonEmptyArray.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* An array guaranteed to have at least one element.
|
|
4
|
+
* The first element resolves to `T` instead of `T | undefined`.
|
|
5
|
+
*
|
|
6
|
+
* @template T - The type of the elements.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* const a: NonEmptyArray<number> = [1, 2, 3]; // ok
|
|
10
|
+
* const b: NonEmptyArray<number> = []; // error: empty array not allowed
|
|
11
|
+
*/
|
|
12
|
+
type NonEmptyArray<T> = [T, ...T[]];
|
|
13
|
+
//#endregion
|
|
14
|
+
export { NonEmptyArray };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//#region src/types/Simplify.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Flattens an intersection or mapped type into a single, readable object type.
|
|
4
|
+
*
|
|
5
|
+
* The result is equivalent for plain object types, but editors show the
|
|
6
|
+
* resolved shape (`{ a: 1; b: 2 }`) instead of `A & B`.
|
|
7
|
+
*
|
|
8
|
+
* @template T - The type to flatten.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* type A = { name: string };
|
|
12
|
+
* type B = { age: number };
|
|
13
|
+
* type User = Simplify<A & B>;
|
|
14
|
+
* // hover => { name: string; age: number } (instead of A & B)
|
|
15
|
+
*/
|
|
16
|
+
type Simplify<T> = { [K in keyof T]: T[K] } & {};
|
|
17
|
+
//#endregion
|
|
18
|
+
export { Simplify };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//#region src/types/Simplify.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Flattens an intersection or mapped type into a single, readable object type.
|
|
4
|
+
*
|
|
5
|
+
* The result is equivalent for plain object types, but editors show the
|
|
6
|
+
* resolved shape (`{ a: 1; b: 2 }`) instead of `A & B`.
|
|
7
|
+
*
|
|
8
|
+
* @template T - The type to flatten.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* type A = { name: string };
|
|
12
|
+
* type B = { age: number };
|
|
13
|
+
* type User = Simplify<A & B>;
|
|
14
|
+
* // hover => { name: string; age: number } (instead of A & B)
|
|
15
|
+
*/
|
|
16
|
+
type Simplify<T> = { [K in keyof T]: T[K] } & {};
|
|
17
|
+
//#endregion
|
|
18
|
+
export { Simplify };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region src/types/ValueOf.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Creates a union of all value types in `T`. The value-side counterpart to `keyof`.
|
|
4
|
+
*
|
|
5
|
+
* @template T - The object type to read values from.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* const STATUS = { IDLE: 'idle', ERROR: 'error' } as const;
|
|
9
|
+
* type Status = ValueOf<typeof STATUS>;
|
|
10
|
+
* // => 'idle' | 'error'
|
|
11
|
+
*/
|
|
12
|
+
type ValueOf<T> = T[keyof T];
|
|
13
|
+
//#endregion
|
|
14
|
+
export { ValueOf };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region src/types/ValueOf.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Creates a union of all value types in `T`. The value-side counterpart to `keyof`.
|
|
4
|
+
*
|
|
5
|
+
* @template T - The object type to read values from.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* const STATUS = { IDLE: 'idle', ERROR: 'error' } as const;
|
|
9
|
+
* type Status = ValueOf<typeof STATUS>;
|
|
10
|
+
* // => 'idle' | 'error'
|
|
11
|
+
*/
|
|
12
|
+
type ValueOf<T> = T[keyof T];
|
|
13
|
+
//#endregion
|
|
14
|
+
export { ValueOf };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/types/Writable.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Removes the `readonly` modifier from all properties of `T`.
|
|
4
|
+
* The inverse of the built-in `Readonly`.
|
|
5
|
+
*
|
|
6
|
+
* @template T - The object type to make writable.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* type Config = { readonly host: string; readonly port: number };
|
|
10
|
+
* type MutableConfig = Writable<Config>;
|
|
11
|
+
* // => { host: string; port: number }
|
|
12
|
+
*/
|
|
13
|
+
type Writable<T> = { -readonly [K in keyof T]: T[K] };
|
|
14
|
+
//#endregion
|
|
15
|
+
export { Writable };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/types/Writable.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Removes the `readonly` modifier from all properties of `T`.
|
|
4
|
+
* The inverse of the built-in `Readonly`.
|
|
5
|
+
*
|
|
6
|
+
* @template T - The object type to make writable.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* type Config = { readonly host: string; readonly port: number };
|
|
10
|
+
* type MutableConfig = Writable<Config>;
|
|
11
|
+
* // => { host: string; port: number }
|
|
12
|
+
*/
|
|
13
|
+
type Writable<T> = { -readonly [K in keyof T]: T[K] };
|
|
14
|
+
//#endregion
|
|
15
|
+
export { Writable };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { DeepPartial } from "./DeepPartial.mjs";
|
|
2
|
+
import { DeepReadonly } from "./DeepReadonly.mjs";
|
|
3
|
+
import { NonEmptyArray } from "./NonEmptyArray.mjs";
|
|
4
|
+
import { Simplify } from "./Simplify.mjs";
|
|
5
|
+
import { ValueOf } from "./ValueOf.mjs";
|
|
6
|
+
import { Writable } from "./Writable.mjs";
|
|
7
|
+
export { type DeepPartial, type DeepReadonly, type NonEmptyArray, type Simplify, type ValueOf, type Writable };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { DeepPartial } from "./DeepPartial.js";
|
|
2
|
+
import { DeepReadonly } from "./DeepReadonly.js";
|
|
3
|
+
import { NonEmptyArray } from "./NonEmptyArray.js";
|
|
4
|
+
import { Simplify } from "./Simplify.js";
|
|
5
|
+
import { ValueOf } from "./ValueOf.js";
|
|
6
|
+
import { Writable } from "./Writable.js";
|
|
7
|
+
export { type DeepPartial, type DeepReadonly, type NonEmptyArray, type Simplify, type ValueOf, type Writable };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "es-toolkit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.50.0-dev.1975+a443efd8",
|
|
4
4
|
"description": "A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.",
|
|
5
5
|
"homepage": "https://es-toolkit.dev",
|
|
6
6
|
"bugs": "https://github.com/toss/es-toolkit/issues",
|
|
@@ -164,6 +164,14 @@
|
|
|
164
164
|
"default": "./dist/string/index.js"
|
|
165
165
|
}
|
|
166
166
|
},
|
|
167
|
+
"./types": {
|
|
168
|
+
"import": {
|
|
169
|
+
"types": "./dist/types/index.d.mts"
|
|
170
|
+
},
|
|
171
|
+
"require": {
|
|
172
|
+
"types": "./dist/types/index.d.ts"
|
|
173
|
+
}
|
|
174
|
+
},
|
|
167
175
|
"./util": {
|
|
168
176
|
"import": {
|
|
169
177
|
"types": "./dist/util/index.d.mts",
|
|
@@ -197,10 +205,11 @@
|
|
|
197
205
|
],
|
|
198
206
|
"workspaces": [
|
|
199
207
|
"docs",
|
|
200
|
-
"benchmarks"
|
|
208
|
+
"benchmarks",
|
|
209
|
+
"tests/types"
|
|
201
210
|
],
|
|
202
211
|
"scripts": {
|
|
203
|
-
"bench": "
|
|
212
|
+
"bench": "yarn workspace benchmarks bench",
|
|
204
213
|
"build": "tsdown && ./.scripts/postbuild.sh",
|
|
205
214
|
"format": "prettier --write .",
|
|
206
215
|
"gen:benchmark": "node ./.scripts/generate-benchmark.mjs",
|
|
@@ -208,7 +217,7 @@
|
|
|
208
217
|
"lint": "eslint --config eslint.config.mjs --concurrency=auto",
|
|
209
218
|
"packlint": "packlint sort -R",
|
|
210
219
|
"prepack": "yarn build",
|
|
211
|
-
"test": "vitest --coverage
|
|
220
|
+
"test": "vitest --coverage",
|
|
212
221
|
"transform": "jscodeshift -t ./.scripts/tests/transform-lodash-test.ts $0 && prettier --write $0",
|
|
213
222
|
"typecheck": "tsc --noEmit"
|
|
214
223
|
},
|
|
@@ -220,11 +229,10 @@
|
|
|
220
229
|
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
|
|
221
230
|
"@types/broken-link-checker": "0.7.3",
|
|
222
231
|
"@types/jscodeshift": "^0.12.0",
|
|
223
|
-
"@types/lodash": "4.17.20",
|
|
224
232
|
"@types/node": "^24.10.9",
|
|
225
233
|
"@types/tar": "^6.1.13",
|
|
226
234
|
"@typescript-eslint/parser": "^8.26.1",
|
|
227
|
-
"@vitest/coverage-istanbul": "^4.
|
|
235
|
+
"@vitest/coverage-istanbul": "^4.1.10",
|
|
228
236
|
"@vitest/eslint-plugin": "^1.6.6",
|
|
229
237
|
"@vue/compiler-sfc": "^3.5.10",
|
|
230
238
|
"broken-link-checker": "0.7.8",
|
|
@@ -248,7 +256,7 @@
|
|
|
248
256
|
"typescript": "^5.8.2",
|
|
249
257
|
"typescript-eslint": "^8.6.0",
|
|
250
258
|
"vercel": "^54.4.1",
|
|
251
|
-
"vitest": "^4.
|
|
259
|
+
"vitest": "^4.1.10"
|
|
252
260
|
},
|
|
253
261
|
"publishConfig": {
|
|
254
262
|
"access": "public",
|
|
@@ -405,6 +413,14 @@
|
|
|
405
413
|
"default": "./dist/string/index.js"
|
|
406
414
|
}
|
|
407
415
|
},
|
|
416
|
+
"./types": {
|
|
417
|
+
"import": {
|
|
418
|
+
"types": "./dist/types/index.d.mts"
|
|
419
|
+
},
|
|
420
|
+
"require": {
|
|
421
|
+
"types": "./dist/types/index.d.ts"
|
|
422
|
+
}
|
|
423
|
+
},
|
|
408
424
|
"./util": {
|
|
409
425
|
"import": {
|
|
410
426
|
"types": "./dist/util/index.d.mts",
|
package/types.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './dist/types';
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
//#region src/_internal/isEqualsSameValueZero.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* Performs a `SameValueZero` comparison between two values to determine if they are equivalent.
|
|
4
|
-
*
|
|
5
|
-
* @param {any} value - The value to compare.
|
|
6
|
-
* @param {any} other - The other value to compare.
|
|
7
|
-
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* eq(1, 1); // true
|
|
11
|
-
* eq(0, -0); // true
|
|
12
|
-
* eq(NaN, NaN); // true
|
|
13
|
-
* eq('a', Object('a')); // false
|
|
14
|
-
*/
|
|
15
|
-
declare function isEqualsSameValueZero(value: any, other: any): boolean;
|
|
16
|
-
//#endregion
|
|
17
|
-
export { isEqualsSameValueZero };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
//#region src/_internal/isEqualsSameValueZero.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* Performs a `SameValueZero` comparison between two values to determine if they are equivalent.
|
|
4
|
-
*
|
|
5
|
-
* @param {any} value - The value to compare.
|
|
6
|
-
* @param {any} other - The other value to compare.
|
|
7
|
-
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* eq(1, 1); // true
|
|
11
|
-
* eq(0, -0); // true
|
|
12
|
-
* eq(NaN, NaN); // true
|
|
13
|
-
* eq('a', Object('a')); // false
|
|
14
|
-
*/
|
|
15
|
-
declare function isEqualsSameValueZero(value: any, other: any): boolean;
|
|
16
|
-
//#endregion
|
|
17
|
-
export { isEqualsSameValueZero };
|