es-toolkit 1.30.1 → 1.31.0-dev.1000
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 +13 -0
- package/dist/_chunk/AbortError-Cg4ZQ1.js +10 -0
- package/dist/_chunk/delay-_VMfFa.js +25 -0
- package/dist/_chunk/isPlainObject-Xaozpc.js +93 -0
- package/dist/_chunk/{isWeakSet-CvIdTA.js → isWeakSet-BW79-8.js} +37 -71
- package/dist/_chunk/{toMerged-DGFrN7.js → toMerged-BQTfB8.js} +39 -8
- package/dist/_chunk/{unary-CcTNuC.js → unary-c1NFA5.js} +38 -0
- package/dist/_chunk/{zipWith-nbzldx.js → zipWith-Bdyzuy.js} +47 -4
- package/dist/array/groupBy.mjs +2 -2
- package/dist/array/index.d.mts +2 -0
- package/dist/array/index.d.ts +2 -0
- package/dist/array/index.js +3 -1
- package/dist/array/index.mjs +2 -0
- package/dist/array/pull.mjs +9 -2
- package/dist/array/remove.d.mts +19 -0
- package/dist/array/remove.d.ts +19 -0
- package/dist/array/remove.mjs +20 -0
- package/dist/array/windowed.d.mts +50 -0
- package/dist/array/windowed.d.ts +50 -0
- package/dist/array/windowed.mjs +16 -0
- package/dist/browser.global.js +1 -1
- package/dist/browser.global.js.map +1 -1
- package/dist/compat/array/find.d.mts +16 -8
- package/dist/compat/array/find.d.ts +16 -8
- package/dist/compat/array/find.mjs +5 -2
- package/dist/compat/array/pull.d.mts +1 -1
- package/dist/compat/array/pull.d.ts +1 -1
- package/dist/compat/array/pull.mjs +1 -2
- package/dist/compat/array/pullAll.d.mts +19 -0
- package/dist/compat/array/pullAll.d.ts +19 -0
- package/dist/compat/array/pullAll.mjs +7 -0
- package/dist/compat/array/remove.d.mts +50 -0
- package/dist/compat/array/remove.d.ts +50 -0
- package/dist/compat/array/remove.mjs +8 -0
- package/dist/compat/array/reverse.d.mts +24 -0
- package/dist/compat/array/reverse.d.ts +24 -0
- package/dist/compat/array/reverse.mjs +8 -0
- package/dist/compat/function/negate.d.mts +16 -0
- package/dist/compat/function/negate.d.ts +16 -0
- package/dist/compat/function/negate.mjs +10 -0
- package/dist/compat/index.d.mts +14 -2
- package/dist/compat/index.d.ts +14 -2
- package/dist/compat/index.js +114 -41
- package/dist/compat/index.mjs +14 -2
- package/dist/compat/math/multiply.d.mts +18 -0
- package/dist/compat/math/multiply.d.ts +18 -0
- package/dist/compat/math/multiply.mjs +21 -0
- package/dist/compat/math/subtract.d.mts +17 -0
- package/dist/compat/math/subtract.d.ts +17 -0
- package/dist/compat/math/subtract.mjs +5 -0
- package/dist/compat/object/mergeWith.mjs +6 -2
- package/dist/compat/predicate/isBuffer.d.mts +21 -0
- package/dist/compat/predicate/isBuffer.d.ts +21 -0
- package/dist/compat/predicate/isBuffer.mjs +7 -0
- package/dist/compat/predicate/isMatch.mjs +1 -4
- package/dist/compat/util/methodOf.d.mts +22 -0
- package/dist/compat/util/methodOf.d.ts +22 -0
- package/dist/compat/util/methodOf.mjs +9 -0
- package/dist/error/index.d.mts +2 -0
- package/dist/error/index.d.ts +2 -0
- package/dist/error/index.js +15 -0
- package/dist/error/index.mjs +2 -0
- package/dist/function/asyncNoop.d.mts +12 -0
- package/dist/function/asyncNoop.d.ts +12 -0
- package/dist/function/asyncNoop.mjs +3 -0
- package/dist/function/index.d.mts +2 -0
- package/dist/function/index.d.ts +2 -0
- package/dist/function/index.js +3 -1
- package/dist/function/index.mjs +2 -0
- package/dist/function/retry.d.mts +59 -0
- package/dist/function/retry.d.ts +59 -0
- package/dist/function/retry.mjs +35 -0
- package/dist/index.d.mts +7 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +21 -11
- package/dist/index.mjs +7 -0
- package/dist/object/cloneDeepWith.mjs +34 -1
- package/dist/object/flattenObject.d.mts +10 -2
- package/dist/object/flattenObject.d.ts +10 -2
- package/dist/object/flattenObject.mjs +6 -6
- package/dist/object/index.js +1 -1
- package/dist/predicate/index.d.mts +1 -0
- package/dist/predicate/index.d.ts +1 -0
- package/dist/predicate/index.js +3 -2
- package/dist/predicate/index.mjs +1 -0
- package/dist/predicate/isPromise.d.mts +20 -0
- package/dist/predicate/isPromise.d.ts +20 -0
- package/dist/predicate/isPromise.mjs +5 -0
- package/dist/promise/index.d.mts +2 -0
- package/dist/promise/index.d.ts +2 -0
- package/dist/promise/index.js +56 -4
- package/dist/promise/index.mjs +2 -0
- package/dist/promise/mutex.d.mts +64 -0
- package/dist/promise/mutex.d.ts +64 -0
- package/dist/promise/mutex.mjs +16 -0
- package/dist/promise/semaphore.d.mts +81 -0
- package/dist/promise/semaphore.d.ts +81 -0
- package/dist/promise/semaphore.mjs +30 -0
- package/error.d.ts +1 -0
- package/package.json +42 -21
- package/dist/_chunk/index-BGZDR9.js +0 -50
- package/dist/_chunk/isPlainObject-octpoD.js +0 -32
package/dist/compat/index.d.mts
CHANGED
|
@@ -21,6 +21,7 @@ export { unionBy } from '../array/unionBy.mjs';
|
|
|
21
21
|
export { unionWith } from '../array/unionWith.mjs';
|
|
22
22
|
export { uniqWith } from '../array/uniqWith.mjs';
|
|
23
23
|
export { unzipWith } from '../array/unzipWith.mjs';
|
|
24
|
+
export { windowed } from '../array/windowed.mjs';
|
|
24
25
|
export { xor } from '../array/xor.mjs';
|
|
25
26
|
export { xorBy } from '../array/xorBy.mjs';
|
|
26
27
|
export { xorWith } from '../array/xorWith.mjs';
|
|
@@ -28,13 +29,14 @@ export { zipObject } from '../array/zipObject.mjs';
|
|
|
28
29
|
export { zipWith } from '../array/zipWith.mjs';
|
|
29
30
|
export { AbortError } from '../error/AbortError.mjs';
|
|
30
31
|
export { TimeoutError } from '../error/TimeoutError.mjs';
|
|
32
|
+
export { asyncNoop } from '../function/asyncNoop.mjs';
|
|
31
33
|
export { identity } from '../function/identity.mjs';
|
|
32
34
|
export { MemoizeCache, memoize } from '../function/memoize.mjs';
|
|
33
|
-
export { negate } from '../function/negate.mjs';
|
|
34
35
|
export { noop } from '../function/noop.mjs';
|
|
35
36
|
export { once } from '../function/once.mjs';
|
|
36
37
|
export { partial } from '../function/partial.mjs';
|
|
37
38
|
export { partialRight } from '../function/partialRight.mjs';
|
|
39
|
+
export { retry } from '../function/retry.mjs';
|
|
38
40
|
export { ThrottledFunction } from '../function/throttle.mjs';
|
|
39
41
|
export { unary } from '../function/unary.mjs';
|
|
40
42
|
export { mean } from '../math/mean.mjs';
|
|
@@ -49,7 +51,6 @@ export { omitBy } from '../object/omitBy.mjs';
|
|
|
49
51
|
export { pickBy } from '../object/pickBy.mjs';
|
|
50
52
|
export { toMerged } from '../object/toMerged.mjs';
|
|
51
53
|
export { isBlob } from '../predicate/isBlob.mjs';
|
|
52
|
-
export { isBuffer } from '../predicate/isBuffer.mjs';
|
|
53
54
|
export { isEqual } from '../predicate/isEqual.mjs';
|
|
54
55
|
export { isFile } from '../predicate/isFile.mjs';
|
|
55
56
|
export { isFunction } from '../predicate/isFunction.mjs';
|
|
@@ -58,7 +59,10 @@ export { isLength } from '../predicate/isLength.mjs';
|
|
|
58
59
|
export { isNotNil } from '../predicate/isNotNil.mjs';
|
|
59
60
|
export { isNull } from '../predicate/isNull.mjs';
|
|
60
61
|
export { isPrimitive } from '../predicate/isPrimitive.mjs';
|
|
62
|
+
export { isPromise } from '../predicate/isPromise.mjs';
|
|
61
63
|
export { isUndefined } from '../predicate/isUndefined.mjs';
|
|
64
|
+
export { Mutex } from '../promise/mutex.mjs';
|
|
65
|
+
export { Semaphore } from '../promise/semaphore.mjs';
|
|
62
66
|
export { timeout } from '../promise/timeout.mjs';
|
|
63
67
|
export { withTimeout } from '../promise/withTimeout.mjs';
|
|
64
68
|
export { capitalize } from '../string/capitalize.mjs';
|
|
@@ -98,6 +102,9 @@ export { map } from './array/map.mjs';
|
|
|
98
102
|
export { nth } from './array/nth.mjs';
|
|
99
103
|
export { orderBy } from './array/orderBy.mjs';
|
|
100
104
|
export { pull } from './array/pull.mjs';
|
|
105
|
+
export { pullAll } from './array/pullAll.mjs';
|
|
106
|
+
export { remove } from './array/remove.mjs';
|
|
107
|
+
export { reverse } from './array/reverse.mjs';
|
|
101
108
|
export { sample } from './array/sample.mjs';
|
|
102
109
|
export { size } from './array/size.mjs';
|
|
103
110
|
export { slice } from './array/slice.mjs';
|
|
@@ -128,6 +135,7 @@ export { delay } from './function/delay.mjs';
|
|
|
128
135
|
export { flip } from './function/flip.mjs';
|
|
129
136
|
export { flow } from './function/flow.mjs';
|
|
130
137
|
export { flowRight } from './function/flowRight.mjs';
|
|
138
|
+
export { negate } from './function/negate.mjs';
|
|
131
139
|
export { nthArg } from './function/nthArg.mjs';
|
|
132
140
|
export { rearg } from './function/rearg.mjs';
|
|
133
141
|
export { rest } from './function/rest.mjs';
|
|
@@ -140,11 +148,13 @@ export { floor } from './math/floor.mjs';
|
|
|
140
148
|
export { inRange } from './math/inRange.mjs';
|
|
141
149
|
export { max } from './math/max.mjs';
|
|
142
150
|
export { min } from './math/min.mjs';
|
|
151
|
+
export { multiply } from './math/multiply.mjs';
|
|
143
152
|
export { parseInt } from './math/parseInt.mjs';
|
|
144
153
|
export { random } from './math/random.mjs';
|
|
145
154
|
export { range } from './math/range.mjs';
|
|
146
155
|
export { rangeRight } from './math/rangeRight.mjs';
|
|
147
156
|
export { round } from './math/round.mjs';
|
|
157
|
+
export { subtract } from './math/subtract.mjs';
|
|
148
158
|
export { sum } from './math/sum.mjs';
|
|
149
159
|
export { sumBy } from './math/sumBy.mjs';
|
|
150
160
|
export { assignIn, assignIn as extend } from './object/assignIn.mjs';
|
|
@@ -177,6 +187,7 @@ export { isArrayBuffer } from './predicate/isArrayBuffer.mjs';
|
|
|
177
187
|
export { isArrayLike } from './predicate/isArrayLike.mjs';
|
|
178
188
|
export { isArrayLikeObject } from './predicate/isArrayLikeObject.mjs';
|
|
179
189
|
export { isBoolean } from './predicate/isBoolean.mjs';
|
|
190
|
+
export { isBuffer } from './predicate/isBuffer.mjs';
|
|
180
191
|
export { isDate } from './predicate/isDate.mjs';
|
|
181
192
|
export { isElement } from './predicate/isElement.mjs';
|
|
182
193
|
export { isEmpty } from './predicate/isEmpty.mjs';
|
|
@@ -238,6 +249,7 @@ export { iteratee } from './util/iteratee.mjs';
|
|
|
238
249
|
export { lt } from './util/lt.mjs';
|
|
239
250
|
export { lte } from './util/lte.mjs';
|
|
240
251
|
export { method } from './util/method.mjs';
|
|
252
|
+
export { methodOf } from './util/methodOf.mjs';
|
|
241
253
|
export { now } from './util/now.mjs';
|
|
242
254
|
export { stubArray } from './util/stubArray.mjs';
|
|
243
255
|
export { stubFalse } from './util/stubFalse.mjs';
|
package/dist/compat/index.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export { unionBy } from '../array/unionBy.js';
|
|
|
21
21
|
export { unionWith } from '../array/unionWith.js';
|
|
22
22
|
export { uniqWith } from '../array/uniqWith.js';
|
|
23
23
|
export { unzipWith } from '../array/unzipWith.js';
|
|
24
|
+
export { windowed } from '../array/windowed.js';
|
|
24
25
|
export { xor } from '../array/xor.js';
|
|
25
26
|
export { xorBy } from '../array/xorBy.js';
|
|
26
27
|
export { xorWith } from '../array/xorWith.js';
|
|
@@ -28,13 +29,14 @@ export { zipObject } from '../array/zipObject.js';
|
|
|
28
29
|
export { zipWith } from '../array/zipWith.js';
|
|
29
30
|
export { AbortError } from '../error/AbortError.js';
|
|
30
31
|
export { TimeoutError } from '../error/TimeoutError.js';
|
|
32
|
+
export { asyncNoop } from '../function/asyncNoop.js';
|
|
31
33
|
export { identity } from '../function/identity.js';
|
|
32
34
|
export { MemoizeCache, memoize } from '../function/memoize.js';
|
|
33
|
-
export { negate } from '../function/negate.js';
|
|
34
35
|
export { noop } from '../function/noop.js';
|
|
35
36
|
export { once } from '../function/once.js';
|
|
36
37
|
export { partial } from '../function/partial.js';
|
|
37
38
|
export { partialRight } from '../function/partialRight.js';
|
|
39
|
+
export { retry } from '../function/retry.js';
|
|
38
40
|
export { ThrottledFunction } from '../function/throttle.js';
|
|
39
41
|
export { unary } from '../function/unary.js';
|
|
40
42
|
export { mean } from '../math/mean.js';
|
|
@@ -49,7 +51,6 @@ export { omitBy } from '../object/omitBy.js';
|
|
|
49
51
|
export { pickBy } from '../object/pickBy.js';
|
|
50
52
|
export { toMerged } from '../object/toMerged.js';
|
|
51
53
|
export { isBlob } from '../predicate/isBlob.js';
|
|
52
|
-
export { isBuffer } from '../predicate/isBuffer.js';
|
|
53
54
|
export { isEqual } from '../predicate/isEqual.js';
|
|
54
55
|
export { isFile } from '../predicate/isFile.js';
|
|
55
56
|
export { isFunction } from '../predicate/isFunction.js';
|
|
@@ -58,7 +59,10 @@ export { isLength } from '../predicate/isLength.js';
|
|
|
58
59
|
export { isNotNil } from '../predicate/isNotNil.js';
|
|
59
60
|
export { isNull } from '../predicate/isNull.js';
|
|
60
61
|
export { isPrimitive } from '../predicate/isPrimitive.js';
|
|
62
|
+
export { isPromise } from '../predicate/isPromise.js';
|
|
61
63
|
export { isUndefined } from '../predicate/isUndefined.js';
|
|
64
|
+
export { Mutex } from '../promise/mutex.js';
|
|
65
|
+
export { Semaphore } from '../promise/semaphore.js';
|
|
62
66
|
export { timeout } from '../promise/timeout.js';
|
|
63
67
|
export { withTimeout } from '../promise/withTimeout.js';
|
|
64
68
|
export { capitalize } from '../string/capitalize.js';
|
|
@@ -98,6 +102,9 @@ export { map } from './array/map.js';
|
|
|
98
102
|
export { nth } from './array/nth.js';
|
|
99
103
|
export { orderBy } from './array/orderBy.js';
|
|
100
104
|
export { pull } from './array/pull.js';
|
|
105
|
+
export { pullAll } from './array/pullAll.js';
|
|
106
|
+
export { remove } from './array/remove.js';
|
|
107
|
+
export { reverse } from './array/reverse.js';
|
|
101
108
|
export { sample } from './array/sample.js';
|
|
102
109
|
export { size } from './array/size.js';
|
|
103
110
|
export { slice } from './array/slice.js';
|
|
@@ -128,6 +135,7 @@ export { delay } from './function/delay.js';
|
|
|
128
135
|
export { flip } from './function/flip.js';
|
|
129
136
|
export { flow } from './function/flow.js';
|
|
130
137
|
export { flowRight } from './function/flowRight.js';
|
|
138
|
+
export { negate } from './function/negate.js';
|
|
131
139
|
export { nthArg } from './function/nthArg.js';
|
|
132
140
|
export { rearg } from './function/rearg.js';
|
|
133
141
|
export { rest } from './function/rest.js';
|
|
@@ -140,11 +148,13 @@ export { floor } from './math/floor.js';
|
|
|
140
148
|
export { inRange } from './math/inRange.js';
|
|
141
149
|
export { max } from './math/max.js';
|
|
142
150
|
export { min } from './math/min.js';
|
|
151
|
+
export { multiply } from './math/multiply.js';
|
|
143
152
|
export { parseInt } from './math/parseInt.js';
|
|
144
153
|
export { random } from './math/random.js';
|
|
145
154
|
export { range } from './math/range.js';
|
|
146
155
|
export { rangeRight } from './math/rangeRight.js';
|
|
147
156
|
export { round } from './math/round.js';
|
|
157
|
+
export { subtract } from './math/subtract.js';
|
|
148
158
|
export { sum } from './math/sum.js';
|
|
149
159
|
export { sumBy } from './math/sumBy.js';
|
|
150
160
|
export { assignIn, assignIn as extend } from './object/assignIn.js';
|
|
@@ -177,6 +187,7 @@ export { isArrayBuffer } from './predicate/isArrayBuffer.js';
|
|
|
177
187
|
export { isArrayLike } from './predicate/isArrayLike.js';
|
|
178
188
|
export { isArrayLikeObject } from './predicate/isArrayLikeObject.js';
|
|
179
189
|
export { isBoolean } from './predicate/isBoolean.js';
|
|
190
|
+
export { isBuffer } from './predicate/isBuffer.js';
|
|
180
191
|
export { isDate } from './predicate/isDate.js';
|
|
181
192
|
export { isElement } from './predicate/isElement.js';
|
|
182
193
|
export { isEmpty } from './predicate/isEmpty.js';
|
|
@@ -238,6 +249,7 @@ export { iteratee } from './util/iteratee.js';
|
|
|
238
249
|
export { lt } from './util/lt.js';
|
|
239
250
|
export { lte } from './util/lte.js';
|
|
240
251
|
export { method } from './util/method.js';
|
|
252
|
+
export { methodOf } from './util/methodOf.js';
|
|
241
253
|
export { now } from './util/now.js';
|
|
242
254
|
export { stubArray } from './util/stubArray.js';
|
|
243
255
|
export { stubFalse } from './util/stubFalse.js';
|
package/dist/compat/index.js
CHANGED
|
@@ -2,15 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
const zipWith = require('../_chunk/zipWith-
|
|
6
|
-
const
|
|
7
|
-
const
|
|
5
|
+
const zipWith = require('../_chunk/zipWith-Bdyzuy.js');
|
|
6
|
+
const AbortError = require('../_chunk/AbortError-Cg4ZQ1.js');
|
|
7
|
+
const error_index = require('../error/index.js');
|
|
8
|
+
const unary = require('../_chunk/unary-c1NFA5.js');
|
|
8
9
|
const noop = require('../_chunk/noop-2IwLUk.js');
|
|
9
10
|
const range$1 = require('../_chunk/range-HnEIT7.js');
|
|
10
11
|
const randomInt = require('../_chunk/randomInt-CF7bZK.js');
|
|
11
|
-
const toMerged = require('../_chunk/toMerged-
|
|
12
|
-
const isPlainObject$1 = require('../_chunk/isPlainObject-
|
|
13
|
-
const isWeakSet$1 = require('../_chunk/isWeakSet-
|
|
12
|
+
const toMerged = require('../_chunk/toMerged-BQTfB8.js');
|
|
13
|
+
const isPlainObject$1 = require('../_chunk/isPlainObject-Xaozpc.js');
|
|
14
|
+
const isWeakSet$1 = require('../_chunk/isWeakSet-BW79-8.js');
|
|
15
|
+
const promise_index = require('../promise/index.js');
|
|
14
16
|
const upperFirst$1 = require('../_chunk/upperFirst-CorAVn.js');
|
|
15
17
|
const util_index = require('../util/index.js');
|
|
16
18
|
|
|
@@ -258,10 +260,7 @@ function isMatch(target, source) {
|
|
|
258
260
|
}
|
|
259
261
|
const keys = Object.keys(source);
|
|
260
262
|
if (target == null) {
|
|
261
|
-
|
|
262
|
-
return true;
|
|
263
|
-
}
|
|
264
|
-
return false;
|
|
263
|
+
return keys.length === 0;
|
|
265
264
|
}
|
|
266
265
|
if (Array.isArray(source)) {
|
|
267
266
|
return isArrayMatch(target, source);
|
|
@@ -364,14 +363,14 @@ function cloneDeepWith(obj, cloneValue) {
|
|
|
364
363
|
return undefined;
|
|
365
364
|
}
|
|
366
365
|
switch (Object.prototype.toString.call(obj)) {
|
|
367
|
-
case
|
|
368
|
-
case
|
|
369
|
-
case
|
|
366
|
+
case isPlainObject$1.numberTag:
|
|
367
|
+
case isPlainObject$1.stringTag:
|
|
368
|
+
case isPlainObject$1.booleanTag: {
|
|
370
369
|
const result = new obj.constructor(obj?.valueOf());
|
|
371
370
|
toMerged.copyProperties(result, obj);
|
|
372
371
|
return result;
|
|
373
372
|
}
|
|
374
|
-
case
|
|
373
|
+
case isPlainObject$1.argumentsTag: {
|
|
375
374
|
const result = {};
|
|
376
375
|
toMerged.copyProperties(result, obj);
|
|
377
376
|
result.length = obj.length;
|
|
@@ -405,7 +404,7 @@ function isIndex(value, length = Number.MAX_SAFE_INTEGER) {
|
|
|
405
404
|
}
|
|
406
405
|
|
|
407
406
|
function isArguments(value) {
|
|
408
|
-
return value !== null && typeof value === 'object' &&
|
|
407
|
+
return value !== null && typeof value === 'object' && isPlainObject$1.getTag(value) === '[object Arguments]';
|
|
409
408
|
}
|
|
410
409
|
|
|
411
410
|
function has(object, path) {
|
|
@@ -729,11 +728,14 @@ function filter(source, predicate) {
|
|
|
729
728
|
}
|
|
730
729
|
}
|
|
731
730
|
|
|
732
|
-
function find(source, doesMatch) {
|
|
731
|
+
function find(source, doesMatch, fromIndex = 0) {
|
|
733
732
|
if (!source) {
|
|
734
733
|
return undefined;
|
|
735
734
|
}
|
|
736
|
-
|
|
735
|
+
if (fromIndex < 0) {
|
|
736
|
+
fromIndex = Math.max(source.length + fromIndex, 0);
|
|
737
|
+
}
|
|
738
|
+
const values = Array.isArray(source) ? source.slice(fromIndex) : Object.values(source).slice(fromIndex);
|
|
737
739
|
switch (typeof doesMatch) {
|
|
738
740
|
case 'function': {
|
|
739
741
|
if (!Array.isArray(source)) {
|
|
@@ -1168,7 +1170,22 @@ function orderBy(collection, criteria, orders, guard) {
|
|
|
1168
1170
|
}
|
|
1169
1171
|
|
|
1170
1172
|
function pull(arr, ...valuesToRemove) {
|
|
1171
|
-
return zipWith.pull(arr,
|
|
1173
|
+
return zipWith.pull(arr, valuesToRemove);
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
function pullAll(arr, valuesToRemove = []) {
|
|
1177
|
+
return zipWith.pull(arr, Array.from(valuesToRemove));
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
function remove(arr, shouldRemoveElement) {
|
|
1181
|
+
return zipWith.remove(arr, iteratee(shouldRemoveElement));
|
|
1182
|
+
}
|
|
1183
|
+
|
|
1184
|
+
function reverse(array) {
|
|
1185
|
+
if (array == null) {
|
|
1186
|
+
return array;
|
|
1187
|
+
}
|
|
1188
|
+
return array.reverse();
|
|
1172
1189
|
}
|
|
1173
1190
|
|
|
1174
1191
|
function sample(collection) {
|
|
@@ -1690,6 +1707,15 @@ function flowRight(...funcs) {
|
|
|
1690
1707
|
return unary.flowRight(...flattenFuncs);
|
|
1691
1708
|
}
|
|
1692
1709
|
|
|
1710
|
+
function negate(func) {
|
|
1711
|
+
if (typeof func !== 'function') {
|
|
1712
|
+
throw new TypeError('Expected a function');
|
|
1713
|
+
}
|
|
1714
|
+
return function (...args) {
|
|
1715
|
+
return !func.apply(this, args);
|
|
1716
|
+
};
|
|
1717
|
+
}
|
|
1718
|
+
|
|
1693
1719
|
function nthArg(n = 0) {
|
|
1694
1720
|
return function (...args) {
|
|
1695
1721
|
return args.at(toInteger(n));
|
|
@@ -1834,6 +1860,38 @@ function min(items = []) {
|
|
|
1834
1860
|
return minElement;
|
|
1835
1861
|
}
|
|
1836
1862
|
|
|
1863
|
+
function toString(value) {
|
|
1864
|
+
if (value == null) {
|
|
1865
|
+
return '';
|
|
1866
|
+
}
|
|
1867
|
+
if (Array.isArray(value)) {
|
|
1868
|
+
return value.map(toString).join(',');
|
|
1869
|
+
}
|
|
1870
|
+
const result = String(value);
|
|
1871
|
+
if (result === '0' && Object.is(Number(value), -0)) {
|
|
1872
|
+
return '-0';
|
|
1873
|
+
}
|
|
1874
|
+
return result;
|
|
1875
|
+
}
|
|
1876
|
+
|
|
1877
|
+
function multiply(value, other) {
|
|
1878
|
+
if (value === undefined && other === undefined) {
|
|
1879
|
+
return 1;
|
|
1880
|
+
}
|
|
1881
|
+
if (value === undefined || other === undefined) {
|
|
1882
|
+
return value || other;
|
|
1883
|
+
}
|
|
1884
|
+
if (typeof value === 'string' || typeof other === 'string') {
|
|
1885
|
+
value = toString(value);
|
|
1886
|
+
other = toString(other);
|
|
1887
|
+
}
|
|
1888
|
+
else {
|
|
1889
|
+
value = Number(value);
|
|
1890
|
+
other = Number(other);
|
|
1891
|
+
}
|
|
1892
|
+
return value * other;
|
|
1893
|
+
}
|
|
1894
|
+
|
|
1837
1895
|
function parseInt(string, radix = 0, guard) {
|
|
1838
1896
|
if (guard) {
|
|
1839
1897
|
radix = 0;
|
|
@@ -1954,6 +2012,10 @@ function round(number, precision = 0) {
|
|
|
1954
2012
|
return decimalAdjust('round', number, precision);
|
|
1955
2013
|
}
|
|
1956
2014
|
|
|
2015
|
+
function subtract(value, other) {
|
|
2016
|
+
return value - other;
|
|
2017
|
+
}
|
|
2018
|
+
|
|
1957
2019
|
function sumBy(array, iteratee$1) {
|
|
1958
2020
|
if (!array || !array.length) {
|
|
1959
2021
|
return 0;
|
|
@@ -2223,11 +2285,14 @@ function mergeWith(object, ...otherArgs) {
|
|
|
2223
2285
|
let result = object;
|
|
2224
2286
|
for (let i = 0; i < sources.length; i++) {
|
|
2225
2287
|
const source = sources[i];
|
|
2226
|
-
result = mergeWithDeep(
|
|
2288
|
+
result = mergeWithDeep(result, source, merge, new Map());
|
|
2227
2289
|
}
|
|
2228
2290
|
return result;
|
|
2229
2291
|
}
|
|
2230
2292
|
function mergeWithDeep(target, source, merge, stack) {
|
|
2293
|
+
if (isPlainObject$1.isPrimitive(target)) {
|
|
2294
|
+
target = Object(target);
|
|
2295
|
+
}
|
|
2231
2296
|
if (source == null || typeof source !== 'object') {
|
|
2232
2297
|
return target;
|
|
2233
2298
|
}
|
|
@@ -2256,7 +2321,7 @@ function mergeWithDeep(target, source, merge, stack) {
|
|
|
2256
2321
|
sourceValue = cloneDeep(sourceValue);
|
|
2257
2322
|
}
|
|
2258
2323
|
if (Array.isArray(sourceValue)) {
|
|
2259
|
-
if (typeof targetValue === 'object') {
|
|
2324
|
+
if (typeof targetValue === 'object' && targetValue != null) {
|
|
2260
2325
|
const cloned = [];
|
|
2261
2326
|
const targetKeys = Reflect.ownKeys(targetValue);
|
|
2262
2327
|
for (let i = 0; i < targetKeys.length; i++) {
|
|
@@ -2473,6 +2538,10 @@ function isBoolean(value) {
|
|
|
2473
2538
|
return typeof value === 'boolean' || value instanceof Boolean;
|
|
2474
2539
|
}
|
|
2475
2540
|
|
|
2541
|
+
function isBuffer(x) {
|
|
2542
|
+
return isWeakSet$1.isBuffer(x);
|
|
2543
|
+
}
|
|
2544
|
+
|
|
2476
2545
|
function isDate(value) {
|
|
2477
2546
|
return isWeakSet$1.isDate(value);
|
|
2478
2547
|
}
|
|
@@ -2527,7 +2596,7 @@ function isEqualWith(a, b, areValuesEqual = noop.noop) {
|
|
|
2527
2596
|
}
|
|
2528
2597
|
|
|
2529
2598
|
function isError(value) {
|
|
2530
|
-
return
|
|
2599
|
+
return isPlainObject$1.getTag(value) === '[object Error]';
|
|
2531
2600
|
}
|
|
2532
2601
|
|
|
2533
2602
|
function isFinite(value) {
|
|
@@ -2570,20 +2639,6 @@ function isWeakSet(value) {
|
|
|
2570
2639
|
return isWeakSet$1.isWeakSet(value);
|
|
2571
2640
|
}
|
|
2572
2641
|
|
|
2573
|
-
function toString(value) {
|
|
2574
|
-
if (value == null) {
|
|
2575
|
-
return '';
|
|
2576
|
-
}
|
|
2577
|
-
if (Array.isArray(value)) {
|
|
2578
|
-
return value.map(toString).join(',');
|
|
2579
|
-
}
|
|
2580
|
-
const result = String(value);
|
|
2581
|
-
if (result === '0' && Object.is(Number(value), -0)) {
|
|
2582
|
-
return '-0';
|
|
2583
|
-
}
|
|
2584
|
-
return result;
|
|
2585
|
-
}
|
|
2586
|
-
|
|
2587
2642
|
function normalizeForCase(str) {
|
|
2588
2643
|
if (typeof str !== 'string') {
|
|
2589
2644
|
str = toString(str);
|
|
@@ -2931,6 +2986,12 @@ function method(path, ...args) {
|
|
|
2931
2986
|
};
|
|
2932
2987
|
}
|
|
2933
2988
|
|
|
2989
|
+
function methodOf(object, ...args) {
|
|
2990
|
+
return function (path) {
|
|
2991
|
+
return invoke(object, path, args);
|
|
2992
|
+
};
|
|
2993
|
+
}
|
|
2994
|
+
|
|
2934
2995
|
function now() {
|
|
2935
2996
|
return Date.now();
|
|
2936
2997
|
}
|
|
@@ -3037,21 +3098,21 @@ exports.unionBy = zipWith.unionBy;
|
|
|
3037
3098
|
exports.unionWith = zipWith.unionWith;
|
|
3038
3099
|
exports.uniqWith = zipWith.uniqWith;
|
|
3039
3100
|
exports.unzipWith = zipWith.unzipWith;
|
|
3101
|
+
exports.windowed = zipWith.windowed;
|
|
3040
3102
|
exports.xor = zipWith.xor;
|
|
3041
3103
|
exports.xorBy = zipWith.xorBy;
|
|
3042
3104
|
exports.xorWith = zipWith.xorWith;
|
|
3043
3105
|
exports.zipObject = zipWith.zipObject;
|
|
3044
3106
|
exports.zipWith = zipWith.zipWith;
|
|
3045
|
-
exports.AbortError =
|
|
3046
|
-
exports.TimeoutError =
|
|
3047
|
-
exports.
|
|
3048
|
-
exports.withTimeout = promise_index.withTimeout;
|
|
3107
|
+
exports.AbortError = AbortError.AbortError;
|
|
3108
|
+
exports.TimeoutError = error_index.TimeoutError;
|
|
3109
|
+
exports.asyncNoop = unary.asyncNoop;
|
|
3049
3110
|
exports.identity = unary.identity;
|
|
3050
3111
|
exports.memoize = unary.memoize;
|
|
3051
|
-
exports.negate = unary.negate;
|
|
3052
3112
|
exports.once = unary.once;
|
|
3053
3113
|
exports.partial = unary.partial;
|
|
3054
3114
|
exports.partialRight = unary.partialRight;
|
|
3115
|
+
exports.retry = unary.retry;
|
|
3055
3116
|
exports.unary = unary.unary;
|
|
3056
3117
|
exports.noop = noop.noop;
|
|
3057
3118
|
exports.mean = range$1.mean;
|
|
@@ -3069,7 +3130,6 @@ exports.toMerged = toMerged.toMerged;
|
|
|
3069
3130
|
exports.isPrimitive = isPlainObject$1.isPrimitive;
|
|
3070
3131
|
exports.eq = isWeakSet$1.eq;
|
|
3071
3132
|
exports.isBlob = isWeakSet$1.isBlob;
|
|
3072
|
-
exports.isBuffer = isWeakSet$1.isBuffer;
|
|
3073
3133
|
exports.isEqual = isWeakSet$1.isEqual;
|
|
3074
3134
|
exports.isFile = isWeakSet$1.isFile;
|
|
3075
3135
|
exports.isFunction = isWeakSet$1.isFunction;
|
|
@@ -3079,7 +3139,12 @@ exports.isJSONValue = isWeakSet$1.isJSONValue;
|
|
|
3079
3139
|
exports.isLength = isWeakSet$1.isLength;
|
|
3080
3140
|
exports.isNotNil = isWeakSet$1.isNotNil;
|
|
3081
3141
|
exports.isNull = isWeakSet$1.isNull;
|
|
3142
|
+
exports.isPromise = isWeakSet$1.isPromise;
|
|
3082
3143
|
exports.isUndefined = isWeakSet$1.isUndefined;
|
|
3144
|
+
exports.Mutex = promise_index.Mutex;
|
|
3145
|
+
exports.Semaphore = promise_index.Semaphore;
|
|
3146
|
+
exports.timeout = promise_index.timeout;
|
|
3147
|
+
exports.withTimeout = promise_index.withTimeout;
|
|
3083
3148
|
exports.capitalize = upperFirst$1.capitalize;
|
|
3084
3149
|
exports.constantCase = upperFirst$1.constantCase;
|
|
3085
3150
|
exports.pascalCase = upperFirst$1.pascalCase;
|
|
@@ -3159,6 +3224,7 @@ exports.isArrayBuffer = isArrayBuffer;
|
|
|
3159
3224
|
exports.isArrayLike = isArrayLike;
|
|
3160
3225
|
exports.isArrayLikeObject = isArrayLikeObject;
|
|
3161
3226
|
exports.isBoolean = isBoolean;
|
|
3227
|
+
exports.isBuffer = isBuffer;
|
|
3162
3228
|
exports.isDate = isDate;
|
|
3163
3229
|
exports.isElement = isElement;
|
|
3164
3230
|
exports.isEmpty = isEmpty;
|
|
@@ -3201,7 +3267,10 @@ exports.max = max;
|
|
|
3201
3267
|
exports.merge = merge;
|
|
3202
3268
|
exports.mergeWith = mergeWith;
|
|
3203
3269
|
exports.method = method;
|
|
3270
|
+
exports.methodOf = methodOf;
|
|
3204
3271
|
exports.min = min;
|
|
3272
|
+
exports.multiply = multiply;
|
|
3273
|
+
exports.negate = negate;
|
|
3205
3274
|
exports.now = now;
|
|
3206
3275
|
exports.nth = nth;
|
|
3207
3276
|
exports.nthArg = nthArg;
|
|
@@ -3215,13 +3284,16 @@ exports.pick = pick;
|
|
|
3215
3284
|
exports.property = property;
|
|
3216
3285
|
exports.propertyOf = propertyOf;
|
|
3217
3286
|
exports.pull = pull;
|
|
3287
|
+
exports.pullAll = pullAll;
|
|
3218
3288
|
exports.random = random;
|
|
3219
3289
|
exports.range = range;
|
|
3220
3290
|
exports.rangeRight = rangeRight;
|
|
3221
3291
|
exports.rearg = rearg;
|
|
3292
|
+
exports.remove = remove;
|
|
3222
3293
|
exports.repeat = repeat;
|
|
3223
3294
|
exports.replace = replace;
|
|
3224
3295
|
exports.rest = rest;
|
|
3296
|
+
exports.reverse = reverse;
|
|
3225
3297
|
exports.round = round;
|
|
3226
3298
|
exports.sample = sample;
|
|
3227
3299
|
exports.set = set;
|
|
@@ -3238,6 +3310,7 @@ exports.stubFalse = stubFalse;
|
|
|
3238
3310
|
exports.stubObject = stubObject;
|
|
3239
3311
|
exports.stubString = stubString;
|
|
3240
3312
|
exports.stubTrue = stubTrue;
|
|
3313
|
+
exports.subtract = subtract;
|
|
3241
3314
|
exports.sum = sum;
|
|
3242
3315
|
exports.sumBy = sumBy;
|
|
3243
3316
|
exports.tail = tail;
|
package/dist/compat/index.mjs
CHANGED
|
@@ -21,6 +21,7 @@ export { unionBy } from '../array/unionBy.mjs';
|
|
|
21
21
|
export { unionWith } from '../array/unionWith.mjs';
|
|
22
22
|
export { uniqWith } from '../array/uniqWith.mjs';
|
|
23
23
|
export { unzipWith } from '../array/unzipWith.mjs';
|
|
24
|
+
export { windowed } from '../array/windowed.mjs';
|
|
24
25
|
export { xor } from '../array/xor.mjs';
|
|
25
26
|
export { xorBy } from '../array/xorBy.mjs';
|
|
26
27
|
export { xorWith } from '../array/xorWith.mjs';
|
|
@@ -28,13 +29,14 @@ export { zipObject } from '../array/zipObject.mjs';
|
|
|
28
29
|
export { zipWith } from '../array/zipWith.mjs';
|
|
29
30
|
export { AbortError } from '../error/AbortError.mjs';
|
|
30
31
|
export { TimeoutError } from '../error/TimeoutError.mjs';
|
|
32
|
+
export { asyncNoop } from '../function/asyncNoop.mjs';
|
|
31
33
|
export { identity } from '../function/identity.mjs';
|
|
32
34
|
export { memoize } from '../function/memoize.mjs';
|
|
33
|
-
export { negate } from '../function/negate.mjs';
|
|
34
35
|
export { noop } from '../function/noop.mjs';
|
|
35
36
|
export { once } from '../function/once.mjs';
|
|
36
37
|
export { partial } from '../function/partial.mjs';
|
|
37
38
|
export { partialRight } from '../function/partialRight.mjs';
|
|
39
|
+
export { retry } from '../function/retry.mjs';
|
|
38
40
|
export { unary } from '../function/unary.mjs';
|
|
39
41
|
export { mean } from '../math/mean.mjs';
|
|
40
42
|
export { meanBy } from '../math/meanBy.mjs';
|
|
@@ -50,7 +52,6 @@ export { omitBy } from '../object/omitBy.mjs';
|
|
|
50
52
|
export { pickBy } from '../object/pickBy.mjs';
|
|
51
53
|
export { toMerged } from '../object/toMerged.mjs';
|
|
52
54
|
export { isBlob } from '../predicate/isBlob.mjs';
|
|
53
|
-
export { isBuffer } from '../predicate/isBuffer.mjs';
|
|
54
55
|
export { isEqual } from '../predicate/isEqual.mjs';
|
|
55
56
|
export { eq } from './util/eq.mjs';
|
|
56
57
|
export { isFile } from '../predicate/isFile.mjs';
|
|
@@ -59,7 +60,10 @@ export { isJSONArray, isJSONObject, isJSONValue } from '../predicate/isJSONValue
|
|
|
59
60
|
export { isLength } from '../predicate/isLength.mjs';
|
|
60
61
|
export { isNotNil } from '../predicate/isNotNil.mjs';
|
|
61
62
|
export { isNull } from '../predicate/isNull.mjs';
|
|
63
|
+
export { isPromise } from '../predicate/isPromise.mjs';
|
|
62
64
|
export { isUndefined } from '../predicate/isUndefined.mjs';
|
|
65
|
+
export { Mutex } from '../promise/mutex.mjs';
|
|
66
|
+
export { Semaphore } from '../promise/semaphore.mjs';
|
|
63
67
|
export { timeout } from '../promise/timeout.mjs';
|
|
64
68
|
export { withTimeout } from '../promise/withTimeout.mjs';
|
|
65
69
|
export { capitalize } from '../string/capitalize.mjs';
|
|
@@ -100,6 +104,9 @@ export { map } from './array/map.mjs';
|
|
|
100
104
|
export { nth } from './array/nth.mjs';
|
|
101
105
|
export { orderBy } from './array/orderBy.mjs';
|
|
102
106
|
export { pull } from './array/pull.mjs';
|
|
107
|
+
export { pullAll } from './array/pullAll.mjs';
|
|
108
|
+
export { remove } from './array/remove.mjs';
|
|
109
|
+
export { reverse } from './array/reverse.mjs';
|
|
103
110
|
export { sample } from './array/sample.mjs';
|
|
104
111
|
export { size } from './array/size.mjs';
|
|
105
112
|
export { slice } from './array/slice.mjs';
|
|
@@ -130,6 +137,7 @@ export { delay } from './function/delay.mjs';
|
|
|
130
137
|
export { flip } from './function/flip.mjs';
|
|
131
138
|
export { flow } from './function/flow.mjs';
|
|
132
139
|
export { flowRight } from './function/flowRight.mjs';
|
|
140
|
+
export { negate } from './function/negate.mjs';
|
|
133
141
|
export { nthArg } from './function/nthArg.mjs';
|
|
134
142
|
export { rearg } from './function/rearg.mjs';
|
|
135
143
|
export { rest } from './function/rest.mjs';
|
|
@@ -142,11 +150,13 @@ export { floor } from './math/floor.mjs';
|
|
|
142
150
|
export { inRange } from './math/inRange.mjs';
|
|
143
151
|
export { max } from './math/max.mjs';
|
|
144
152
|
export { min } from './math/min.mjs';
|
|
153
|
+
export { multiply } from './math/multiply.mjs';
|
|
145
154
|
export { parseInt } from './math/parseInt.mjs';
|
|
146
155
|
export { random } from './math/random.mjs';
|
|
147
156
|
export { range } from './math/range.mjs';
|
|
148
157
|
export { rangeRight } from './math/rangeRight.mjs';
|
|
149
158
|
export { round } from './math/round.mjs';
|
|
159
|
+
export { subtract } from './math/subtract.mjs';
|
|
150
160
|
export { sum } from './math/sum.mjs';
|
|
151
161
|
export { sumBy } from './math/sumBy.mjs';
|
|
152
162
|
export { assignIn, assignIn as extend } from './object/assignIn.mjs';
|
|
@@ -179,6 +189,7 @@ export { isArrayBuffer } from './predicate/isArrayBuffer.mjs';
|
|
|
179
189
|
export { isArrayLike } from './predicate/isArrayLike.mjs';
|
|
180
190
|
export { isArrayLikeObject } from './predicate/isArrayLikeObject.mjs';
|
|
181
191
|
export { isBoolean } from './predicate/isBoolean.mjs';
|
|
192
|
+
export { isBuffer } from './predicate/isBuffer.mjs';
|
|
182
193
|
export { isDate } from './predicate/isDate.mjs';
|
|
183
194
|
export { isElement } from './predicate/isElement.mjs';
|
|
184
195
|
export { isEmpty } from './predicate/isEmpty.mjs';
|
|
@@ -238,6 +249,7 @@ export { iteratee } from './util/iteratee.mjs';
|
|
|
238
249
|
export { lt } from './util/lt.mjs';
|
|
239
250
|
export { lte } from './util/lte.mjs';
|
|
240
251
|
export { method } from './util/method.mjs';
|
|
252
|
+
export { methodOf } from './util/methodOf.mjs';
|
|
241
253
|
export { now } from './util/now.mjs';
|
|
242
254
|
export { stubArray } from './util/stubArray.mjs';
|
|
243
255
|
export { stubFalse } from './util/stubFalse.mjs';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Multiply two numbers.
|
|
3
|
+
*
|
|
4
|
+
* If either of the numbers is `NaN`, the function returns `NaN`.
|
|
5
|
+
*
|
|
6
|
+
* @param {number} value The first number in a multiplication
|
|
7
|
+
* @param {number} other The second number in a multiplication
|
|
8
|
+
* @returns {number} The product of value and other
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* multiply(2, 3); // => 6
|
|
12
|
+
* multiply(2, NaN); // => NaN
|
|
13
|
+
* multiply(NaN, 3); // => NaN
|
|
14
|
+
* multiply(NaN, NaN); // => NaN
|
|
15
|
+
*/
|
|
16
|
+
declare function multiply(value: number, other: number): number;
|
|
17
|
+
|
|
18
|
+
export { multiply };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Multiply two numbers.
|
|
3
|
+
*
|
|
4
|
+
* If either of the numbers is `NaN`, the function returns `NaN`.
|
|
5
|
+
*
|
|
6
|
+
* @param {number} value The first number in a multiplication
|
|
7
|
+
* @param {number} other The second number in a multiplication
|
|
8
|
+
* @returns {number} The product of value and other
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* multiply(2, 3); // => 6
|
|
12
|
+
* multiply(2, NaN); // => NaN
|
|
13
|
+
* multiply(NaN, 3); // => NaN
|
|
14
|
+
* multiply(NaN, NaN); // => NaN
|
|
15
|
+
*/
|
|
16
|
+
declare function multiply(value: number, other: number): number;
|
|
17
|
+
|
|
18
|
+
export { multiply };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { toString } from '../util/toString.mjs';
|
|
2
|
+
|
|
3
|
+
function multiply(value, other) {
|
|
4
|
+
if (value === undefined && other === undefined) {
|
|
5
|
+
return 1;
|
|
6
|
+
}
|
|
7
|
+
if (value === undefined || other === undefined) {
|
|
8
|
+
return value || other;
|
|
9
|
+
}
|
|
10
|
+
if (typeof value === 'string' || typeof other === 'string') {
|
|
11
|
+
value = toString(value);
|
|
12
|
+
other = toString(other);
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
value = Number(value);
|
|
16
|
+
other = Number(other);
|
|
17
|
+
}
|
|
18
|
+
return value * other;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { multiply };
|