es-toolkit 1.32.0 → 1.33.0-dev.1023
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 +11 -1
- package/dist/_chunk/{isWeakSet-DoHqUM.js → isWeakSet-TIM260.js} +14 -0
- package/dist/_chunk/{toMerged-BQTfB8.js → toMerged-CwnQF6.js} +0 -14
- package/dist/_chunk/{upperFirst-CorAVn.js → upperFirst-nA5L7X.js} +5 -0
- package/dist/browser.global.js +1 -1
- package/dist/browser.global.js.map +1 -1
- package/dist/compat/array/find.mjs +12 -32
- package/dist/compat/array/findLast.d.mts +130 -0
- package/dist/compat/array/findLast.d.ts +130 -0
- package/dist/compat/array/findLast.mjs +32 -0
- package/dist/compat/array/intersectionWith.d.mts +96 -0
- package/dist/compat/array/intersectionWith.d.ts +96 -0
- package/dist/compat/array/intersectionWith.mjs +43 -0
- package/dist/compat/array/pullAllBy.d.mts +64 -0
- package/dist/compat/array/pullAllBy.d.ts +64 -0
- package/dist/compat/array/pullAllBy.mjs +22 -0
- package/dist/compat/array/reduce.d.mts +109 -0
- package/dist/compat/array/reduce.d.ts +109 -0
- package/dist/compat/array/reduce.mjs +33 -0
- package/dist/compat/array/reduceRight.d.mts +109 -0
- package/dist/compat/array/reduceRight.d.ts +109 -0
- package/dist/compat/array/reduceRight.mjs +39 -0
- package/dist/compat/index.d.mts +12 -3
- package/dist/compat/index.d.ts +12 -3
- package/dist/compat/index.js +264 -63
- package/dist/compat/index.mjs +12 -3
- package/dist/compat/math/divide.d.mts +18 -0
- package/dist/compat/math/divide.d.ts +18 -0
- package/dist/compat/math/divide.mjs +23 -0
- package/dist/compat/math/maxBy.d.mts +31 -0
- package/dist/compat/math/maxBy.d.ts +31 -0
- package/dist/compat/math/maxBy.mjs +11 -0
- package/dist/compat/math/multiply.mjs +4 -3
- package/dist/compat/math/sumBy.mjs +8 -3
- package/dist/compat/object/assignIn.mjs +1 -1
- package/dist/compat/object/pickBy.d.mts +22 -0
- package/dist/compat/object/pickBy.d.ts +22 -0
- package/dist/compat/object/pickBy.mjs +23 -0
- package/dist/compat/object/values.d.mts +32 -0
- package/dist/compat/object/values.d.ts +32 -0
- package/dist/compat/object/values.mjs +5 -0
- package/dist/compat/object/valuesIn.d.mts +63 -0
- package/dist/compat/object/valuesIn.d.ts +63 -0
- package/dist/compat/object/valuesIn.mjs +13 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +6 -4
- package/dist/index.mjs +2 -0
- package/dist/object/flattenObject.d.mts +1 -1
- package/dist/object/flattenObject.d.ts +1 -1
- package/dist/object/index.js +15 -2
- package/dist/predicate/index.d.mts +1 -0
- package/dist/predicate/index.d.ts +1 -0
- package/dist/predicate/index.js +2 -1
- package/dist/predicate/index.mjs +1 -0
- package/dist/predicate/isJSON.d.mts +31 -0
- package/dist/predicate/isJSON.d.ts +31 -0
- package/dist/predicate/isJSON.mjs +14 -0
- package/dist/string/index.d.mts +1 -0
- package/dist/string/index.d.ts +1 -0
- package/dist/string/index.js +2 -1
- package/dist/string/index.mjs +1 -0
- package/dist/string/reverseString.d.mts +16 -0
- package/dist/string/reverseString.d.ts +16 -0
- package/dist/string/reverseString.mjs +5 -0
- package/package.json +2 -1
package/dist/compat/index.d.mts
CHANGED
|
@@ -5,11 +5,9 @@ export { flatMapDeep } from '../array/flatMapDeep.mjs';
|
|
|
5
5
|
export { forEachRight } from '../array/forEachRight.mjs';
|
|
6
6
|
export { groupBy } from '../array/groupBy.mjs';
|
|
7
7
|
export { initial } from '../array/initial.mjs';
|
|
8
|
-
export { intersectionWith } from '../array/intersectionWith.mjs';
|
|
9
8
|
export { isSubset } from '../array/isSubset.mjs';
|
|
10
9
|
export { isSubsetWith } from '../array/isSubsetWith.mjs';
|
|
11
10
|
export { keyBy } from '../array/keyBy.mjs';
|
|
12
|
-
export { maxBy } from '../array/maxBy.mjs';
|
|
13
11
|
export { minBy } from '../array/minBy.mjs';
|
|
14
12
|
export { partition } from '../array/partition.mjs';
|
|
15
13
|
export { pullAt } from '../array/pullAt.mjs';
|
|
@@ -48,12 +46,12 @@ export { clone } from '../object/clone.mjs';
|
|
|
48
46
|
export { flattenObject } from '../object/flattenObject.mjs';
|
|
49
47
|
export { invert } from '../object/invert.mjs';
|
|
50
48
|
export { omitBy } from '../object/omitBy.mjs';
|
|
51
|
-
export { pickBy } from '../object/pickBy.mjs';
|
|
52
49
|
export { toMerged } from '../object/toMerged.mjs';
|
|
53
50
|
export { isBlob } from '../predicate/isBlob.mjs';
|
|
54
51
|
export { isEqual } from '../predicate/isEqual.mjs';
|
|
55
52
|
export { isFile } from '../predicate/isFile.mjs';
|
|
56
53
|
export { isFunction } from '../predicate/isFunction.mjs';
|
|
54
|
+
export { isJSON } from '../predicate/isJSON.mjs';
|
|
57
55
|
export { isJSONArray, isJSONObject, isJSONValue } from '../predicate/isJSONValue.mjs';
|
|
58
56
|
export { isLength } from '../predicate/isLength.mjs';
|
|
59
57
|
export { isNotNil } from '../predicate/isNotNil.mjs';
|
|
@@ -68,6 +66,7 @@ export { withTimeout } from '../promise/withTimeout.mjs';
|
|
|
68
66
|
export { capitalize } from '../string/capitalize.mjs';
|
|
69
67
|
export { constantCase } from '../string/constantCase.mjs';
|
|
70
68
|
export { pascalCase } from '../string/pascalCase.mjs';
|
|
69
|
+
export { reverseString } from '../string/reverseString.mjs';
|
|
71
70
|
export { invariant } from '../util/invariant.mjs';
|
|
72
71
|
export { castArray } from './array/castArray.mjs';
|
|
73
72
|
export { chunk } from './array/chunk.mjs';
|
|
@@ -85,6 +84,7 @@ export { fill } from './array/fill.mjs';
|
|
|
85
84
|
export { filter } from './array/filter.mjs';
|
|
86
85
|
export { find } from './array/find.mjs';
|
|
87
86
|
export { findIndex } from './array/findIndex.mjs';
|
|
87
|
+
export { findLast } from './array/findLast.mjs';
|
|
88
88
|
export { findLastIndex } from './array/findLastIndex.mjs';
|
|
89
89
|
export { flatten } from './array/flatten.mjs';
|
|
90
90
|
export { flattenDeep } from './array/flattenDeep.mjs';
|
|
@@ -95,6 +95,7 @@ export { includes } from './array/includes.mjs';
|
|
|
95
95
|
export { indexOf } from './array/indexOf.mjs';
|
|
96
96
|
export { intersection } from './array/intersection.mjs';
|
|
97
97
|
export { intersectionBy } from './array/intersectionBy.mjs';
|
|
98
|
+
export { intersectionWith } from './array/intersectionWith.mjs';
|
|
98
99
|
export { join } from './array/join.mjs';
|
|
99
100
|
export { last } from './array/last.mjs';
|
|
100
101
|
export { lastIndexOf } from './array/lastIndexOf.mjs';
|
|
@@ -103,6 +104,9 @@ export { nth } from './array/nth.mjs';
|
|
|
103
104
|
export { orderBy } from './array/orderBy.mjs';
|
|
104
105
|
export { pull } from './array/pull.mjs';
|
|
105
106
|
export { pullAll } from './array/pullAll.mjs';
|
|
107
|
+
export { pullAllBy } from './array/pullAllBy.mjs';
|
|
108
|
+
export { reduce } from './array/reduce.mjs';
|
|
109
|
+
export { reduceRight } from './array/reduceRight.mjs';
|
|
106
110
|
export { remove } from './array/remove.mjs';
|
|
107
111
|
export { reverse } from './array/reverse.mjs';
|
|
108
112
|
export { sample } from './array/sample.mjs';
|
|
@@ -146,9 +150,11 @@ export { throttle } from './function/throttle.mjs';
|
|
|
146
150
|
export { add } from './math/add.mjs';
|
|
147
151
|
export { ceil } from './math/ceil.mjs';
|
|
148
152
|
export { clamp } from './math/clamp.mjs';
|
|
153
|
+
export { divide } from './math/divide.mjs';
|
|
149
154
|
export { floor } from './math/floor.mjs';
|
|
150
155
|
export { inRange } from './math/inRange.mjs';
|
|
151
156
|
export { max } from './math/max.mjs';
|
|
157
|
+
export { maxBy } from './math/maxBy.mjs';
|
|
152
158
|
export { min } from './math/min.mjs';
|
|
153
159
|
export { multiply } from './math/multiply.mjs';
|
|
154
160
|
export { parseInt } from './math/parseInt.mjs';
|
|
@@ -176,11 +182,14 @@ export { merge } from './object/merge.mjs';
|
|
|
176
182
|
export { mergeWith } from './object/mergeWith.mjs';
|
|
177
183
|
export { omit } from './object/omit.mjs';
|
|
178
184
|
export { pick } from './object/pick.mjs';
|
|
185
|
+
export { pickBy } from './object/pickBy.mjs';
|
|
179
186
|
export { property } from './object/property.mjs';
|
|
180
187
|
export { propertyOf } from './object/propertyOf.mjs';
|
|
181
188
|
export { set } from './object/set.mjs';
|
|
182
189
|
export { toDefaulted } from './object/toDefaulted.mjs';
|
|
183
190
|
export { unset } from './object/unset.mjs';
|
|
191
|
+
export { values } from './object/values.mjs';
|
|
192
|
+
export { valuesIn } from './object/valuesIn.mjs';
|
|
184
193
|
export { conforms } from './predicate/conforms.mjs';
|
|
185
194
|
export { conformsTo } from './predicate/conformsTo.mjs';
|
|
186
195
|
export { isArguments } from './predicate/isArguments.mjs';
|
package/dist/compat/index.d.ts
CHANGED
|
@@ -5,11 +5,9 @@ export { flatMapDeep } from '../array/flatMapDeep.js';
|
|
|
5
5
|
export { forEachRight } from '../array/forEachRight.js';
|
|
6
6
|
export { groupBy } from '../array/groupBy.js';
|
|
7
7
|
export { initial } from '../array/initial.js';
|
|
8
|
-
export { intersectionWith } from '../array/intersectionWith.js';
|
|
9
8
|
export { isSubset } from '../array/isSubset.js';
|
|
10
9
|
export { isSubsetWith } from '../array/isSubsetWith.js';
|
|
11
10
|
export { keyBy } from '../array/keyBy.js';
|
|
12
|
-
export { maxBy } from '../array/maxBy.js';
|
|
13
11
|
export { minBy } from '../array/minBy.js';
|
|
14
12
|
export { partition } from '../array/partition.js';
|
|
15
13
|
export { pullAt } from '../array/pullAt.js';
|
|
@@ -48,12 +46,12 @@ export { clone } from '../object/clone.js';
|
|
|
48
46
|
export { flattenObject } from '../object/flattenObject.js';
|
|
49
47
|
export { invert } from '../object/invert.js';
|
|
50
48
|
export { omitBy } from '../object/omitBy.js';
|
|
51
|
-
export { pickBy } from '../object/pickBy.js';
|
|
52
49
|
export { toMerged } from '../object/toMerged.js';
|
|
53
50
|
export { isBlob } from '../predicate/isBlob.js';
|
|
54
51
|
export { isEqual } from '../predicate/isEqual.js';
|
|
55
52
|
export { isFile } from '../predicate/isFile.js';
|
|
56
53
|
export { isFunction } from '../predicate/isFunction.js';
|
|
54
|
+
export { isJSON } from '../predicate/isJSON.js';
|
|
57
55
|
export { isJSONArray, isJSONObject, isJSONValue } from '../predicate/isJSONValue.js';
|
|
58
56
|
export { isLength } from '../predicate/isLength.js';
|
|
59
57
|
export { isNotNil } from '../predicate/isNotNil.js';
|
|
@@ -68,6 +66,7 @@ export { withTimeout } from '../promise/withTimeout.js';
|
|
|
68
66
|
export { capitalize } from '../string/capitalize.js';
|
|
69
67
|
export { constantCase } from '../string/constantCase.js';
|
|
70
68
|
export { pascalCase } from '../string/pascalCase.js';
|
|
69
|
+
export { reverseString } from '../string/reverseString.js';
|
|
71
70
|
export { invariant } from '../util/invariant.js';
|
|
72
71
|
export { castArray } from './array/castArray.js';
|
|
73
72
|
export { chunk } from './array/chunk.js';
|
|
@@ -85,6 +84,7 @@ export { fill } from './array/fill.js';
|
|
|
85
84
|
export { filter } from './array/filter.js';
|
|
86
85
|
export { find } from './array/find.js';
|
|
87
86
|
export { findIndex } from './array/findIndex.js';
|
|
87
|
+
export { findLast } from './array/findLast.js';
|
|
88
88
|
export { findLastIndex } from './array/findLastIndex.js';
|
|
89
89
|
export { flatten } from './array/flatten.js';
|
|
90
90
|
export { flattenDeep } from './array/flattenDeep.js';
|
|
@@ -95,6 +95,7 @@ export { includes } from './array/includes.js';
|
|
|
95
95
|
export { indexOf } from './array/indexOf.js';
|
|
96
96
|
export { intersection } from './array/intersection.js';
|
|
97
97
|
export { intersectionBy } from './array/intersectionBy.js';
|
|
98
|
+
export { intersectionWith } from './array/intersectionWith.js';
|
|
98
99
|
export { join } from './array/join.js';
|
|
99
100
|
export { last } from './array/last.js';
|
|
100
101
|
export { lastIndexOf } from './array/lastIndexOf.js';
|
|
@@ -103,6 +104,9 @@ export { nth } from './array/nth.js';
|
|
|
103
104
|
export { orderBy } from './array/orderBy.js';
|
|
104
105
|
export { pull } from './array/pull.js';
|
|
105
106
|
export { pullAll } from './array/pullAll.js';
|
|
107
|
+
export { pullAllBy } from './array/pullAllBy.js';
|
|
108
|
+
export { reduce } from './array/reduce.js';
|
|
109
|
+
export { reduceRight } from './array/reduceRight.js';
|
|
106
110
|
export { remove } from './array/remove.js';
|
|
107
111
|
export { reverse } from './array/reverse.js';
|
|
108
112
|
export { sample } from './array/sample.js';
|
|
@@ -146,9 +150,11 @@ export { throttle } from './function/throttle.js';
|
|
|
146
150
|
export { add } from './math/add.js';
|
|
147
151
|
export { ceil } from './math/ceil.js';
|
|
148
152
|
export { clamp } from './math/clamp.js';
|
|
153
|
+
export { divide } from './math/divide.js';
|
|
149
154
|
export { floor } from './math/floor.js';
|
|
150
155
|
export { inRange } from './math/inRange.js';
|
|
151
156
|
export { max } from './math/max.js';
|
|
157
|
+
export { maxBy } from './math/maxBy.js';
|
|
152
158
|
export { min } from './math/min.js';
|
|
153
159
|
export { multiply } from './math/multiply.js';
|
|
154
160
|
export { parseInt } from './math/parseInt.js';
|
|
@@ -176,11 +182,14 @@ export { merge } from './object/merge.js';
|
|
|
176
182
|
export { mergeWith } from './object/mergeWith.js';
|
|
177
183
|
export { omit } from './object/omit.js';
|
|
178
184
|
export { pick } from './object/pick.js';
|
|
185
|
+
export { pickBy } from './object/pickBy.js';
|
|
179
186
|
export { property } from './object/property.js';
|
|
180
187
|
export { propertyOf } from './object/propertyOf.js';
|
|
181
188
|
export { set } from './object/set.js';
|
|
182
189
|
export { toDefaulted } from './object/toDefaulted.js';
|
|
183
190
|
export { unset } from './object/unset.js';
|
|
191
|
+
export { values } from './object/values.js';
|
|
192
|
+
export { valuesIn } from './object/valuesIn.js';
|
|
184
193
|
export { conforms } from './predicate/conforms.js';
|
|
185
194
|
export { conformsTo } from './predicate/conformsTo.js';
|
|
186
195
|
export { isArguments } from './predicate/isArguments.js';
|
package/dist/compat/index.js
CHANGED
|
@@ -9,11 +9,11 @@ const unary = require('../_chunk/unary-c1NFA5.js');
|
|
|
9
9
|
const noop = require('../_chunk/noop-2IwLUk.js');
|
|
10
10
|
const range$1 = require('../_chunk/range-HnEIT7.js');
|
|
11
11
|
const randomInt = require('../_chunk/randomInt-CF7bZK.js');
|
|
12
|
-
const toMerged = require('../_chunk/toMerged-
|
|
12
|
+
const toMerged = require('../_chunk/toMerged-CwnQF6.js');
|
|
13
13
|
const isPlainObject$1 = require('../_chunk/isPlainObject-Xaozpc.js');
|
|
14
|
-
const isWeakSet$1 = require('../_chunk/isWeakSet-
|
|
14
|
+
const isWeakSet$1 = require('../_chunk/isWeakSet-TIM260.js');
|
|
15
15
|
const promise_index = require('../promise/index.js');
|
|
16
|
-
const upperFirst$1 = require('../_chunk/upperFirst-
|
|
16
|
+
const upperFirst$1 = require('../_chunk/upperFirst-nA5L7X.js');
|
|
17
17
|
const util_index = require('../util/index.js');
|
|
18
18
|
|
|
19
19
|
function castArray(value) {
|
|
@@ -728,45 +728,27 @@ function filter(source, predicate) {
|
|
|
728
728
|
}
|
|
729
729
|
}
|
|
730
730
|
|
|
731
|
-
function find(source,
|
|
731
|
+
function find(source, _doesMatch, fromIndex = 0) {
|
|
732
732
|
if (!source) {
|
|
733
733
|
return undefined;
|
|
734
734
|
}
|
|
735
735
|
if (fromIndex < 0) {
|
|
736
736
|
fromIndex = Math.max(source.length + fromIndex, 0);
|
|
737
737
|
}
|
|
738
|
+
const doesMatch = iteratee(_doesMatch);
|
|
738
739
|
const values = Array.isArray(source) ? source.slice(fromIndex) : Object.values(source).slice(fromIndex);
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
if (doesMatch(value, key, source)) {
|
|
747
|
-
return value;
|
|
748
|
-
}
|
|
749
|
-
}
|
|
750
|
-
return undefined;
|
|
751
|
-
}
|
|
752
|
-
return values.find(doesMatch);
|
|
753
|
-
}
|
|
754
|
-
case 'object': {
|
|
755
|
-
if (Array.isArray(doesMatch) && doesMatch.length === 2) {
|
|
756
|
-
const key = doesMatch[0];
|
|
757
|
-
const value = doesMatch[1];
|
|
758
|
-
return values.find(matchesProperty(key, value));
|
|
740
|
+
if (typeof doesMatch === 'function' && !Array.isArray(source)) {
|
|
741
|
+
const keys = Object.keys(source).slice(fromIndex);
|
|
742
|
+
for (let i = 0; i < keys.length; i++) {
|
|
743
|
+
const key = keys[i];
|
|
744
|
+
const value = source[key];
|
|
745
|
+
if (doesMatch(value, key, source)) {
|
|
746
|
+
return value;
|
|
759
747
|
}
|
|
760
|
-
else {
|
|
761
|
-
return values.find(matches(doesMatch));
|
|
762
|
-
}
|
|
763
|
-
}
|
|
764
|
-
case 'symbol':
|
|
765
|
-
case 'number':
|
|
766
|
-
case 'string': {
|
|
767
|
-
return values.find(property(doesMatch));
|
|
768
748
|
}
|
|
749
|
+
return undefined;
|
|
769
750
|
}
|
|
751
|
+
return values.find(doesMatch);
|
|
770
752
|
}
|
|
771
753
|
|
|
772
754
|
function findIndex(arr, doesMatch, fromIndex = 0) {
|
|
@@ -803,6 +785,34 @@ function findIndex(arr, doesMatch, fromIndex = 0) {
|
|
|
803
785
|
return index === -1 ? -1 : index + fromIndex;
|
|
804
786
|
}
|
|
805
787
|
|
|
788
|
+
function findLast(source, _doesMatch, fromIndex) {
|
|
789
|
+
if (!source) {
|
|
790
|
+
return undefined;
|
|
791
|
+
}
|
|
792
|
+
const length = Array.isArray(source) ? source.length : Object.keys(source).length;
|
|
793
|
+
fromIndex = toInteger(fromIndex ?? length - 1);
|
|
794
|
+
if (fromIndex < 0) {
|
|
795
|
+
fromIndex = Math.max(length + fromIndex, 0);
|
|
796
|
+
}
|
|
797
|
+
else {
|
|
798
|
+
fromIndex = Math.min(fromIndex, length - 1);
|
|
799
|
+
}
|
|
800
|
+
const doesMatch = iteratee(_doesMatch);
|
|
801
|
+
const values = Array.isArray(source) ? source.slice(0, fromIndex + 1) : Object.values(source).slice(0, fromIndex + 1);
|
|
802
|
+
if (typeof doesMatch === 'function' && !Array.isArray(source)) {
|
|
803
|
+
const keys = Object.keys(source).slice(0, fromIndex + 1);
|
|
804
|
+
for (let i = fromIndex; i >= 0; i--) {
|
|
805
|
+
const key = keys[i];
|
|
806
|
+
const value = source[key];
|
|
807
|
+
if (doesMatch(value, key, source)) {
|
|
808
|
+
return value;
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
return undefined;
|
|
812
|
+
}
|
|
813
|
+
return values.findLast(doesMatch);
|
|
814
|
+
}
|
|
815
|
+
|
|
806
816
|
function findLastIndex(arr, doesMatch, fromIndex = arr ? arr.length - 1 : 0) {
|
|
807
817
|
if (!arr) {
|
|
808
818
|
return -1;
|
|
@@ -996,6 +1006,50 @@ function intersectionBy(array, ...values) {
|
|
|
996
1006
|
return result;
|
|
997
1007
|
}
|
|
998
1008
|
|
|
1009
|
+
function uniq(arr) {
|
|
1010
|
+
if (!isArrayLike(arr)) {
|
|
1011
|
+
return [];
|
|
1012
|
+
}
|
|
1013
|
+
return zipWith.uniq(Array.from(arr));
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1016
|
+
function intersectionWith(firstArr, ...otherArrs) {
|
|
1017
|
+
console.log(firstArr);
|
|
1018
|
+
if (firstArr == null) {
|
|
1019
|
+
return [];
|
|
1020
|
+
}
|
|
1021
|
+
const _comparator = last(otherArrs);
|
|
1022
|
+
let comparator = isWeakSet$1.eq;
|
|
1023
|
+
let uniq$1 = uniq;
|
|
1024
|
+
if (typeof _comparator === 'function') {
|
|
1025
|
+
comparator = _comparator;
|
|
1026
|
+
uniq$1 = uniqPreserve0;
|
|
1027
|
+
otherArrs.pop();
|
|
1028
|
+
}
|
|
1029
|
+
let result = uniq$1(Array.from(firstArr));
|
|
1030
|
+
for (let i = 0; i < otherArrs.length; ++i) {
|
|
1031
|
+
const otherArr = otherArrs[i];
|
|
1032
|
+
if (otherArr == null) {
|
|
1033
|
+
return [];
|
|
1034
|
+
}
|
|
1035
|
+
result = zipWith.intersectionWith(result, Array.from(otherArr), comparator);
|
|
1036
|
+
}
|
|
1037
|
+
return result;
|
|
1038
|
+
}
|
|
1039
|
+
function uniqPreserve0(arr) {
|
|
1040
|
+
const result = [];
|
|
1041
|
+
const added = new Set();
|
|
1042
|
+
for (let i = 0; i < arr.length; i++) {
|
|
1043
|
+
const item = arr[i];
|
|
1044
|
+
if (added.has(item)) {
|
|
1045
|
+
continue;
|
|
1046
|
+
}
|
|
1047
|
+
result.push(item);
|
|
1048
|
+
added.add(item);
|
|
1049
|
+
}
|
|
1050
|
+
return result;
|
|
1051
|
+
}
|
|
1052
|
+
|
|
999
1053
|
function join(array, separator = ',') {
|
|
1000
1054
|
if (!isArrayLike(array)) {
|
|
1001
1055
|
return '';
|
|
@@ -1177,6 +1231,87 @@ function pullAll(arr, valuesToRemove = []) {
|
|
|
1177
1231
|
return zipWith.pull(arr, Array.from(valuesToRemove));
|
|
1178
1232
|
}
|
|
1179
1233
|
|
|
1234
|
+
function pullAllBy(arr, valuesToRemove, _getValue) {
|
|
1235
|
+
const getValue = iteratee(_getValue);
|
|
1236
|
+
const valuesSet = new Set(Array.from(valuesToRemove).map(x => getValue(x)));
|
|
1237
|
+
let resultIndex = 0;
|
|
1238
|
+
for (let i = 0; i < arr.length; i++) {
|
|
1239
|
+
const value = getValue(arr[i]);
|
|
1240
|
+
if (valuesSet.has(value)) {
|
|
1241
|
+
continue;
|
|
1242
|
+
}
|
|
1243
|
+
if (!Object.hasOwn(arr, i)) {
|
|
1244
|
+
delete arr[resultIndex++];
|
|
1245
|
+
continue;
|
|
1246
|
+
}
|
|
1247
|
+
arr[resultIndex++] = arr[i];
|
|
1248
|
+
}
|
|
1249
|
+
arr.length = resultIndex;
|
|
1250
|
+
return arr;
|
|
1251
|
+
}
|
|
1252
|
+
|
|
1253
|
+
function reduce(collection, iteratee = unary.identity, accumulator) {
|
|
1254
|
+
if (!collection) {
|
|
1255
|
+
return accumulator;
|
|
1256
|
+
}
|
|
1257
|
+
let keys;
|
|
1258
|
+
let startIndex = 0;
|
|
1259
|
+
if (isArrayLike(collection)) {
|
|
1260
|
+
keys = range$1.range(0, collection.length);
|
|
1261
|
+
if (accumulator == null && collection.length > 0) {
|
|
1262
|
+
accumulator = collection[0];
|
|
1263
|
+
startIndex += 1;
|
|
1264
|
+
}
|
|
1265
|
+
}
|
|
1266
|
+
else {
|
|
1267
|
+
keys = Object.keys(collection);
|
|
1268
|
+
if (accumulator == null) {
|
|
1269
|
+
accumulator = collection[keys[0]];
|
|
1270
|
+
startIndex += 1;
|
|
1271
|
+
}
|
|
1272
|
+
}
|
|
1273
|
+
for (let i = startIndex; i < keys.length; i++) {
|
|
1274
|
+
const key = keys[i];
|
|
1275
|
+
const value = collection[key];
|
|
1276
|
+
accumulator = iteratee(accumulator, value, key, collection);
|
|
1277
|
+
}
|
|
1278
|
+
return accumulator;
|
|
1279
|
+
}
|
|
1280
|
+
|
|
1281
|
+
function reduceRight(collection, iteratee = unary.identity, accumulator) {
|
|
1282
|
+
if (!collection) {
|
|
1283
|
+
return accumulator;
|
|
1284
|
+
}
|
|
1285
|
+
let keys;
|
|
1286
|
+
let startIndex;
|
|
1287
|
+
if (isArrayLike(collection)) {
|
|
1288
|
+
keys = range$1.range(0, collection.length).reverse();
|
|
1289
|
+
if (accumulator == null && collection.length > 0) {
|
|
1290
|
+
accumulator = collection[collection.length - 1];
|
|
1291
|
+
startIndex = 1;
|
|
1292
|
+
}
|
|
1293
|
+
else {
|
|
1294
|
+
startIndex = 0;
|
|
1295
|
+
}
|
|
1296
|
+
}
|
|
1297
|
+
else {
|
|
1298
|
+
keys = Object.keys(collection).reverse();
|
|
1299
|
+
if (accumulator == null) {
|
|
1300
|
+
accumulator = collection[keys[0]];
|
|
1301
|
+
startIndex = 1;
|
|
1302
|
+
}
|
|
1303
|
+
else {
|
|
1304
|
+
startIndex = 0;
|
|
1305
|
+
}
|
|
1306
|
+
}
|
|
1307
|
+
for (let i = startIndex; i < keys.length; i++) {
|
|
1308
|
+
const key = keys[i];
|
|
1309
|
+
const value = collection[key];
|
|
1310
|
+
accumulator = iteratee(accumulator, value, key, collection);
|
|
1311
|
+
}
|
|
1312
|
+
return accumulator;
|
|
1313
|
+
}
|
|
1314
|
+
|
|
1180
1315
|
function remove(arr, shouldRemoveElement) {
|
|
1181
1316
|
return zipWith.remove(arr, iteratee(shouldRemoveElement));
|
|
1182
1317
|
}
|
|
@@ -1419,13 +1554,6 @@ function union(...arrays) {
|
|
|
1419
1554
|
return zipWith.uniq(flattened);
|
|
1420
1555
|
}
|
|
1421
1556
|
|
|
1422
|
-
function uniq(arr) {
|
|
1423
|
-
if (!isArrayLike(arr)) {
|
|
1424
|
-
return [];
|
|
1425
|
-
}
|
|
1426
|
-
return zipWith.uniq(Array.from(arr));
|
|
1427
|
-
}
|
|
1428
|
-
|
|
1429
1557
|
function uniqBy(array, iteratee$1) {
|
|
1430
1558
|
if (!isArrayLikeObject(array)) {
|
|
1431
1559
|
return [];
|
|
@@ -1889,6 +2017,39 @@ function clamp(value, bound1, bound2) {
|
|
|
1889
2017
|
return range$1.clamp(value, bound1, bound2);
|
|
1890
2018
|
}
|
|
1891
2019
|
|
|
2020
|
+
function toString(value) {
|
|
2021
|
+
if (value == null) {
|
|
2022
|
+
return '';
|
|
2023
|
+
}
|
|
2024
|
+
if (Array.isArray(value)) {
|
|
2025
|
+
return value.map(toString).join(',');
|
|
2026
|
+
}
|
|
2027
|
+
const result = String(value);
|
|
2028
|
+
if (result === '0' && Object.is(Number(value), -0)) {
|
|
2029
|
+
return '-0';
|
|
2030
|
+
}
|
|
2031
|
+
return result;
|
|
2032
|
+
}
|
|
2033
|
+
|
|
2034
|
+
function divide(value, other) {
|
|
2035
|
+
console.log(value, other);
|
|
2036
|
+
if (value === undefined && other === undefined) {
|
|
2037
|
+
return 1;
|
|
2038
|
+
}
|
|
2039
|
+
if (value === undefined || other === undefined) {
|
|
2040
|
+
return value ?? other;
|
|
2041
|
+
}
|
|
2042
|
+
if (typeof value === 'string' || typeof other === 'string') {
|
|
2043
|
+
value = toString(value);
|
|
2044
|
+
other = toString(other);
|
|
2045
|
+
}
|
|
2046
|
+
else {
|
|
2047
|
+
value = toNumber(value);
|
|
2048
|
+
other = toNumber(other);
|
|
2049
|
+
}
|
|
2050
|
+
return value / other;
|
|
2051
|
+
}
|
|
2052
|
+
|
|
1892
2053
|
function floor(number, precision = 0) {
|
|
1893
2054
|
return decimalAdjust('floor', number, precision);
|
|
1894
2055
|
}
|
|
@@ -1931,6 +2092,13 @@ function max(items = []) {
|
|
|
1931
2092
|
return maxElement;
|
|
1932
2093
|
}
|
|
1933
2094
|
|
|
2095
|
+
function maxBy(items, iteratee$1) {
|
|
2096
|
+
if (items == null) {
|
|
2097
|
+
return undefined;
|
|
2098
|
+
}
|
|
2099
|
+
return zipWith.maxBy(Array.from(items), iteratee(iteratee$1));
|
|
2100
|
+
}
|
|
2101
|
+
|
|
1934
2102
|
function min(items = []) {
|
|
1935
2103
|
let minElement = items[0];
|
|
1936
2104
|
let min = undefined;
|
|
@@ -1944,34 +2112,20 @@ function min(items = []) {
|
|
|
1944
2112
|
return minElement;
|
|
1945
2113
|
}
|
|
1946
2114
|
|
|
1947
|
-
function toString(value) {
|
|
1948
|
-
if (value == null) {
|
|
1949
|
-
return '';
|
|
1950
|
-
}
|
|
1951
|
-
if (Array.isArray(value)) {
|
|
1952
|
-
return value.map(toString).join(',');
|
|
1953
|
-
}
|
|
1954
|
-
const result = String(value);
|
|
1955
|
-
if (result === '0' && Object.is(Number(value), -0)) {
|
|
1956
|
-
return '-0';
|
|
1957
|
-
}
|
|
1958
|
-
return result;
|
|
1959
|
-
}
|
|
1960
|
-
|
|
1961
2115
|
function multiply(value, other) {
|
|
1962
2116
|
if (value === undefined && other === undefined) {
|
|
1963
2117
|
return 1;
|
|
1964
2118
|
}
|
|
1965
2119
|
if (value === undefined || other === undefined) {
|
|
1966
|
-
return value
|
|
2120
|
+
return value ?? other;
|
|
1967
2121
|
}
|
|
1968
2122
|
if (typeof value === 'string' || typeof other === 'string') {
|
|
1969
2123
|
value = toString(value);
|
|
1970
2124
|
other = toString(other);
|
|
1971
2125
|
}
|
|
1972
2126
|
else {
|
|
1973
|
-
value =
|
|
1974
|
-
other =
|
|
2127
|
+
value = toNumber(value);
|
|
2128
|
+
other = toNumber(other);
|
|
1975
2129
|
}
|
|
1976
2130
|
return value * other;
|
|
1977
2131
|
}
|
|
@@ -2107,11 +2261,16 @@ function sumBy(array, iteratee$1) {
|
|
|
2107
2261
|
if (iteratee$1 != null) {
|
|
2108
2262
|
iteratee$1 = iteratee(iteratee$1);
|
|
2109
2263
|
}
|
|
2110
|
-
let result =
|
|
2111
|
-
for (let i =
|
|
2264
|
+
let result = undefined;
|
|
2265
|
+
for (let i = 0; i < array.length; i++) {
|
|
2112
2266
|
const current = iteratee$1 ? iteratee$1(array[i]) : array[i];
|
|
2113
2267
|
if (current !== undefined) {
|
|
2114
|
-
result
|
|
2268
|
+
if (result === undefined) {
|
|
2269
|
+
result = current;
|
|
2270
|
+
}
|
|
2271
|
+
else {
|
|
2272
|
+
result += current;
|
|
2273
|
+
}
|
|
2115
2274
|
}
|
|
2116
2275
|
}
|
|
2117
2276
|
return result;
|
|
@@ -2199,7 +2358,7 @@ function assignInImpl(object, source) {
|
|
|
2199
2358
|
const keys = keysIn(source);
|
|
2200
2359
|
for (let i = 0; i < keys.length; i++) {
|
|
2201
2360
|
const key = keys[i];
|
|
2202
|
-
if (!isWeakSet$1.eq(object[key], source[key])) {
|
|
2361
|
+
if (!(key in object) || !isWeakSet$1.eq(object[key], source[key])) {
|
|
2203
2362
|
object[key] = source[key];
|
|
2204
2363
|
}
|
|
2205
2364
|
}
|
|
@@ -2573,6 +2732,25 @@ function pick(obj, ...keysArr) {
|
|
|
2573
2732
|
return result;
|
|
2574
2733
|
}
|
|
2575
2734
|
|
|
2735
|
+
function pickBy(obj, shouldPick) {
|
|
2736
|
+
if (obj == null) {
|
|
2737
|
+
return {};
|
|
2738
|
+
}
|
|
2739
|
+
const result = {};
|
|
2740
|
+
if (shouldPick == null) {
|
|
2741
|
+
return obj;
|
|
2742
|
+
}
|
|
2743
|
+
const keys = isArrayLike(obj) ? range$1.range(0, obj.length) : Object.keys(obj);
|
|
2744
|
+
for (let i = 0; i < keys.length; i++) {
|
|
2745
|
+
const key = keys[i].toString();
|
|
2746
|
+
const value = obj[key];
|
|
2747
|
+
if (shouldPick(value, key, obj)) {
|
|
2748
|
+
result[key] = value;
|
|
2749
|
+
}
|
|
2750
|
+
}
|
|
2751
|
+
return result;
|
|
2752
|
+
}
|
|
2753
|
+
|
|
2576
2754
|
function propertyOf(object) {
|
|
2577
2755
|
return function (path) {
|
|
2578
2756
|
return get(object, path);
|
|
@@ -2584,6 +2762,20 @@ function toDefaulted(object, ...sources) {
|
|
|
2584
2762
|
return defaults(cloned, ...sources);
|
|
2585
2763
|
}
|
|
2586
2764
|
|
|
2765
|
+
function values(object) {
|
|
2766
|
+
return Object.values(object);
|
|
2767
|
+
}
|
|
2768
|
+
|
|
2769
|
+
function valuesIn(object) {
|
|
2770
|
+
const keys = keysIn(object);
|
|
2771
|
+
const result = new Array(keys.length);
|
|
2772
|
+
for (let i = 0; i < keys.length; i++) {
|
|
2773
|
+
const key = keys[i];
|
|
2774
|
+
result[i] = object[key];
|
|
2775
|
+
}
|
|
2776
|
+
return result;
|
|
2777
|
+
}
|
|
2778
|
+
|
|
2587
2779
|
function conformsTo(target, source) {
|
|
2588
2780
|
if (source == null) {
|
|
2589
2781
|
return true;
|
|
@@ -3154,11 +3346,9 @@ exports.flatMapDeep = zipWith.flatMapDeep;
|
|
|
3154
3346
|
exports.forEachRight = zipWith.forEachRight;
|
|
3155
3347
|
exports.groupBy = zipWith.groupBy;
|
|
3156
3348
|
exports.initial = zipWith.initial;
|
|
3157
|
-
exports.intersectionWith = zipWith.intersectionWith;
|
|
3158
3349
|
exports.isSubset = zipWith.isSubset;
|
|
3159
3350
|
exports.isSubsetWith = zipWith.isSubsetWith;
|
|
3160
3351
|
exports.keyBy = zipWith.keyBy;
|
|
3161
|
-
exports.maxBy = zipWith.maxBy;
|
|
3162
3352
|
exports.minBy = zipWith.minBy;
|
|
3163
3353
|
exports.partition = zipWith.partition;
|
|
3164
3354
|
exports.pullAt = zipWith.pullAt;
|
|
@@ -3197,7 +3387,6 @@ exports.flattenObject = toMerged.flattenObject;
|
|
|
3197
3387
|
exports.invert = toMerged.invert;
|
|
3198
3388
|
exports.isObjectLike = toMerged.isObjectLike;
|
|
3199
3389
|
exports.omitBy = toMerged.omitBy;
|
|
3200
|
-
exports.pickBy = toMerged.pickBy;
|
|
3201
3390
|
exports.toMerged = toMerged.toMerged;
|
|
3202
3391
|
exports.isPrimitive = isPlainObject$1.isPrimitive;
|
|
3203
3392
|
exports.eq = isWeakSet$1.eq;
|
|
@@ -3205,6 +3394,7 @@ exports.isBlob = isWeakSet$1.isBlob;
|
|
|
3205
3394
|
exports.isEqual = isWeakSet$1.isEqual;
|
|
3206
3395
|
exports.isFile = isWeakSet$1.isFile;
|
|
3207
3396
|
exports.isFunction = isWeakSet$1.isFunction;
|
|
3397
|
+
exports.isJSON = isWeakSet$1.isJSON;
|
|
3208
3398
|
exports.isJSONArray = isWeakSet$1.isJSONArray;
|
|
3209
3399
|
exports.isJSONObject = isWeakSet$1.isJSONObject;
|
|
3210
3400
|
exports.isJSONValue = isWeakSet$1.isJSONValue;
|
|
@@ -3220,6 +3410,7 @@ exports.withTimeout = promise_index.withTimeout;
|
|
|
3220
3410
|
exports.capitalize = upperFirst$1.capitalize;
|
|
3221
3411
|
exports.constantCase = upperFirst$1.constantCase;
|
|
3222
3412
|
exports.pascalCase = upperFirst$1.pascalCase;
|
|
3413
|
+
exports.reverseString = upperFirst$1.reverseString;
|
|
3223
3414
|
exports.invariant = util_index.invariant;
|
|
3224
3415
|
exports.add = add;
|
|
3225
3416
|
exports.after = after;
|
|
@@ -3252,6 +3443,7 @@ exports.delay = delay;
|
|
|
3252
3443
|
exports.difference = difference;
|
|
3253
3444
|
exports.differenceBy = differenceBy;
|
|
3254
3445
|
exports.differenceWith = differenceWith;
|
|
3446
|
+
exports.divide = divide;
|
|
3255
3447
|
exports.drop = drop;
|
|
3256
3448
|
exports.dropRight = dropRight;
|
|
3257
3449
|
exports.dropRightWhile = dropRightWhile;
|
|
@@ -3267,6 +3459,7 @@ exports.filter = filter;
|
|
|
3267
3459
|
exports.find = find;
|
|
3268
3460
|
exports.findIndex = findIndex;
|
|
3269
3461
|
exports.findKey = findKey;
|
|
3462
|
+
exports.findLast = findLast;
|
|
3270
3463
|
exports.findLastIndex = findLastIndex;
|
|
3271
3464
|
exports.first = head;
|
|
3272
3465
|
exports.flatten = flatten;
|
|
@@ -3288,6 +3481,7 @@ exports.includes = includes;
|
|
|
3288
3481
|
exports.indexOf = indexOf;
|
|
3289
3482
|
exports.intersection = intersection;
|
|
3290
3483
|
exports.intersectionBy = intersectionBy;
|
|
3484
|
+
exports.intersectionWith = intersectionWith;
|
|
3291
3485
|
exports.invertBy = invertBy;
|
|
3292
3486
|
exports.invoke = invoke;
|
|
3293
3487
|
exports.isArguments = isArguments;
|
|
@@ -3336,6 +3530,7 @@ exports.mapValues = mapValues;
|
|
|
3336
3530
|
exports.matches = matches;
|
|
3337
3531
|
exports.matchesProperty = matchesProperty;
|
|
3338
3532
|
exports.max = max;
|
|
3533
|
+
exports.maxBy = maxBy;
|
|
3339
3534
|
exports.merge = merge;
|
|
3340
3535
|
exports.mergeWith = mergeWith;
|
|
3341
3536
|
exports.method = method;
|
|
@@ -3353,14 +3548,18 @@ exports.padEnd = padEnd;
|
|
|
3353
3548
|
exports.padStart = padStart;
|
|
3354
3549
|
exports.parseInt = parseInt;
|
|
3355
3550
|
exports.pick = pick;
|
|
3551
|
+
exports.pickBy = pickBy;
|
|
3356
3552
|
exports.property = property;
|
|
3357
3553
|
exports.propertyOf = propertyOf;
|
|
3358
3554
|
exports.pull = pull;
|
|
3359
3555
|
exports.pullAll = pullAll;
|
|
3556
|
+
exports.pullAllBy = pullAllBy;
|
|
3360
3557
|
exports.random = random;
|
|
3361
3558
|
exports.range = range;
|
|
3362
3559
|
exports.rangeRight = rangeRight;
|
|
3363
3560
|
exports.rearg = rearg;
|
|
3561
|
+
exports.reduce = reduce;
|
|
3562
|
+
exports.reduceRight = reduceRight;
|
|
3364
3563
|
exports.remove = remove;
|
|
3365
3564
|
exports.repeat = repeat;
|
|
3366
3565
|
exports.replace = replace;
|
|
@@ -3419,6 +3618,8 @@ exports.unset = unset;
|
|
|
3419
3618
|
exports.unzip = unzip;
|
|
3420
3619
|
exports.upperCase = upperCase;
|
|
3421
3620
|
exports.upperFirst = upperFirst;
|
|
3621
|
+
exports.values = values;
|
|
3622
|
+
exports.valuesIn = valuesIn;
|
|
3422
3623
|
exports.without = without;
|
|
3423
3624
|
exports.words = words;
|
|
3424
3625
|
exports.zip = zip;
|