es-toolkit 1.35.0-dev.1202 → 1.35.0-dev.1209
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunk/{isPromise-ByAybB.js → isPromise-BqEEYJ.js} +126 -40
- package/dist/_chunk/{reverseString-D-wK2p.js → reverseString-BixeGz.js} +84 -13
- package/dist/_chunk/toSnakeCaseKeys-Bvb9j3.js +4578 -0
- package/dist/_chunk/{unary-BsNWRM.js → unary-EIEhcF.js} +46 -0
- package/dist/_chunk/{zip-DxZJSH.js → zipWith-CsbMsR.js} +114 -3
- package/dist/array/index.js +57 -126
- package/dist/array/take.d.mts +1 -1
- package/dist/array/take.d.ts +1 -1
- package/dist/array/take.mjs +4 -1
- package/dist/array/takeRight.d.mts +1 -1
- package/dist/array/takeRight.d.ts +1 -1
- package/dist/array/takeRight.mjs +5 -2
- package/dist/browser.global.js +1 -1
- package/dist/browser.global.js.map +1 -1
- package/dist/compat/compat.d.mts +301 -0
- package/dist/compat/compat.d.ts +301 -0
- package/dist/compat/compat.mjs +303 -0
- package/dist/compat/function/partial.d.mts +575 -0
- package/dist/compat/function/partial.d.ts +575 -0
- package/dist/compat/function/partial.mjs +8 -0
- package/dist/compat/function/partialRight.d.mts +651 -0
- package/dist/compat/function/partialRight.d.ts +651 -0
- package/dist/compat/function/partialRight.mjs +8 -0
- package/dist/compat/index.d.mts +10 -18
- package/dist/compat/index.d.ts +10 -18
- package/dist/compat/index.js +280 -4043
- package/dist/compat/index.mjs +13 -19
- package/dist/compat/object/defaults.mjs +7 -1
- package/dist/compat/string/repeat.d.mts +1 -1
- package/dist/compat/string/repeat.d.ts +1 -1
- package/dist/compat/string/repeat.mjs +12 -2
- package/dist/compat/string/words.d.mts +1 -1
- package/dist/compat/string/words.d.ts +1 -1
- package/dist/compat/string/words.mjs +2 -1
- package/dist/compat/toolkit.d.mts +9 -0
- package/dist/compat/toolkit.d.ts +9 -0
- package/dist/compat/toolkit.mjs +10 -0
- package/dist/function/index.js +3 -4
- package/dist/function/partial.d.mts +3 -3
- package/dist/function/partial.d.ts +3 -3
- package/dist/function/partial.mjs +17 -19
- package/dist/function/partialRight.d.mts +3 -3
- package/dist/function/partialRight.d.ts +3 -3
- package/dist/function/partialRight.mjs +18 -20
- package/dist/index.js +84 -87
- package/dist/object/index.js +15 -15
- package/dist/object/toCamelCaseKeys.mjs +3 -0
- package/dist/object/toSnakeCaseKeys.mjs +3 -0
- package/dist/predicate/index.js +4 -5
- package/dist/string/index.js +7 -8
- package/package.json +1 -1
- package/dist/_chunk/isPlainObject-Xaozpc.js +0 -93
- package/dist/_chunk/partialRight-B0_CSB.js +0 -50
- package/dist/_chunk/snakeCase-BtVEeB.js +0 -75
- package/dist/_chunk/toSnakeCaseKeys-BNpS71.js +0 -569
- package/dist/compat/_internal/copyArray.mjs +0 -12
- package/dist/compat/array/flatMap.d.mts +0 -20
- package/dist/compat/array/flatMap.d.ts +0 -20
- package/dist/compat/array/flatMap.mjs +0 -13
- package/dist/compat/array/forEachRight.d.mts +0 -106
- package/dist/compat/array/forEachRight.d.ts +0 -106
- package/dist/compat/array/forEachRight.mjs +0 -21
- package/dist/compat/array/partition.d.mts +0 -65
- package/dist/compat/array/partition.d.ts +0 -65
- package/dist/compat/array/partition.mjs +0 -24
- package/dist/compat/array/pullAllWith.d.mts +0 -59
- package/dist/compat/array/pullAllWith.d.ts +0 -59
- package/dist/compat/array/pullAllWith.mjs +0 -33
- package/dist/compat/array/pullAt.d.mts +0 -32
- package/dist/compat/array/pullAt.d.ts +0 -32
- package/dist/compat/array/pullAt.mjs +0 -34
- package/dist/compat/array/zipObject.d.mts +0 -49
- package/dist/compat/array/zipObject.d.ts +0 -49
- package/dist/compat/array/zipObject.mjs +0 -11
- package/dist/compat/array/zipWith.d.mts +0 -92
- package/dist/compat/array/zipWith.d.ts +0 -92
- package/dist/compat/array/zipWith.mjs +0 -20
- package/dist/compat/object/at.d.mts +0 -19
- package/dist/compat/object/at.d.ts +0 -19
- package/dist/compat/object/at.mjs +0 -27
- package/dist/compat/object/forIn.d.mts +0 -58
- package/dist/compat/object/forIn.d.ts +0 -58
- package/dist/compat/object/forIn.mjs +0 -16
- package/dist/compat/object/forInRight.d.mts +0 -58
- package/dist/compat/object/forInRight.d.ts +0 -58
- package/dist/compat/object/forInRight.mjs +0 -21
- package/dist/compat/object/forOwn.d.mts +0 -54
- package/dist/compat/object/forOwn.d.ts +0 -54
- package/dist/compat/object/forOwn.mjs +0 -19
- package/dist/compat/object/forOwnRight.d.mts +0 -54
- package/dist/compat/object/forOwnRight.d.ts +0 -54
- package/dist/compat/object/forOwnRight.mjs +0 -19
- package/dist/compat/object/hasIn.d.mts +0 -40
- package/dist/compat/object/hasIn.d.ts +0 -40
- package/dist/compat/object/hasIn.mjs +0 -34
- package/dist/compat/string/split.d.mts +0 -19
- package/dist/compat/string/split.d.ts +0 -19
- package/dist/compat/string/split.mjs +0 -7
- package/dist/compat/util/overEvery.d.mts +0 -67
- package/dist/compat/util/overEvery.d.ts +0 -67
- package/dist/compat/util/overEvery.mjs +0 -23
- package/dist/compat/util/overSome.d.mts +0 -69
- package/dist/compat/util/overSome.d.ts +0 -69
- package/dist/compat/util/overSome.mjs +0 -23
|
@@ -134,6 +134,48 @@ function once(func) {
|
|
|
134
134
|
};
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
+
function partial(func, ...partialArgs) {
|
|
138
|
+
return partialImpl(func, placeholderSymbol$1, ...partialArgs);
|
|
139
|
+
}
|
|
140
|
+
function partialImpl(func, placeholder, ...partialArgs) {
|
|
141
|
+
const partialed = function (...providedArgs) {
|
|
142
|
+
let providedArgsIndex = 0;
|
|
143
|
+
const substitutedArgs = partialArgs
|
|
144
|
+
.slice()
|
|
145
|
+
.map(arg => (arg === placeholder ? providedArgs[providedArgsIndex++] : arg));
|
|
146
|
+
const remainingArgs = providedArgs.slice(providedArgsIndex);
|
|
147
|
+
return func.apply(this, substitutedArgs.concat(remainingArgs));
|
|
148
|
+
};
|
|
149
|
+
if (func.prototype) {
|
|
150
|
+
partialed.prototype = Object.create(func.prototype);
|
|
151
|
+
}
|
|
152
|
+
return partialed;
|
|
153
|
+
}
|
|
154
|
+
const placeholderSymbol$1 = Symbol('partial.placeholder');
|
|
155
|
+
partial.placeholder = placeholderSymbol$1;
|
|
156
|
+
|
|
157
|
+
function partialRight(func, ...partialArgs) {
|
|
158
|
+
return partialRightImpl(func, placeholderSymbol, ...partialArgs);
|
|
159
|
+
}
|
|
160
|
+
function partialRightImpl(func, placeholder, ...partialArgs) {
|
|
161
|
+
const partialedRight = function (...providedArgs) {
|
|
162
|
+
const placeholderLength = partialArgs.filter(arg => arg === placeholder).length;
|
|
163
|
+
const rangeLength = Math.max(providedArgs.length - placeholderLength, 0);
|
|
164
|
+
const remainingArgs = providedArgs.slice(0, rangeLength);
|
|
165
|
+
let providedArgsIndex = rangeLength;
|
|
166
|
+
const substitutedArgs = partialArgs
|
|
167
|
+
.slice()
|
|
168
|
+
.map(arg => (arg === placeholder ? providedArgs[providedArgsIndex++] : arg));
|
|
169
|
+
return func.apply(this, remainingArgs.concat(substitutedArgs));
|
|
170
|
+
};
|
|
171
|
+
if (func.prototype) {
|
|
172
|
+
partialedRight.prototype = Object.create(func.prototype);
|
|
173
|
+
}
|
|
174
|
+
return partialedRight;
|
|
175
|
+
}
|
|
176
|
+
const placeholderSymbol = Symbol('partialRight.placeholder');
|
|
177
|
+
partialRight.placeholder = placeholderSymbol;
|
|
178
|
+
|
|
137
179
|
function rest(func, startIndex = func.length - 1) {
|
|
138
180
|
return function (...args) {
|
|
139
181
|
const rest = args.slice(startIndex);
|
|
@@ -192,6 +234,10 @@ exports.identity = identity;
|
|
|
192
234
|
exports.memoize = memoize;
|
|
193
235
|
exports.negate = negate;
|
|
194
236
|
exports.once = once;
|
|
237
|
+
exports.partial = partial;
|
|
238
|
+
exports.partialImpl = partialImpl;
|
|
239
|
+
exports.partialRight = partialRight;
|
|
240
|
+
exports.partialRightImpl = partialRightImpl;
|
|
195
241
|
exports.rest = rest;
|
|
196
242
|
exports.retry = retry;
|
|
197
243
|
exports.unary = unary;
|
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
const randomInt = require('./randomInt-CF7bZK.js');
|
|
4
4
|
|
|
5
|
+
function at(arr, indices) {
|
|
6
|
+
const result = new Array(indices.length);
|
|
7
|
+
const length = arr.length;
|
|
8
|
+
for (let i = 0; i < indices.length; i++) {
|
|
9
|
+
let index = indices[i];
|
|
10
|
+
index = Number.isInteger(index) ? index : Math.trunc(index) || 0;
|
|
11
|
+
if (index < 0) {
|
|
12
|
+
index += length;
|
|
13
|
+
}
|
|
14
|
+
result[i] = arr[index];
|
|
15
|
+
}
|
|
16
|
+
return result;
|
|
17
|
+
}
|
|
18
|
+
|
|
5
19
|
function chunk(arr, size) {
|
|
6
20
|
if (!Number.isInteger(size) || size <= 0) {
|
|
7
21
|
throw new Error('Size must be an integer greater than zero.');
|
|
@@ -115,6 +129,10 @@ function flatten(arr, depth = 1) {
|
|
|
115
129
|
return result;
|
|
116
130
|
}
|
|
117
131
|
|
|
132
|
+
function flatMap(arr, iteratee, depth = 1) {
|
|
133
|
+
return flatten(arr.map(item => iteratee(item)), depth);
|
|
134
|
+
}
|
|
135
|
+
|
|
118
136
|
function flattenDeep(arr) {
|
|
119
137
|
return flatten(arr, Infinity);
|
|
120
138
|
}
|
|
@@ -123,6 +141,13 @@ function flatMapDeep(arr, iteratee) {
|
|
|
123
141
|
return flattenDeep(arr.map((item) => iteratee(item)));
|
|
124
142
|
}
|
|
125
143
|
|
|
144
|
+
function forEachRight(arr, callback) {
|
|
145
|
+
for (let i = arr.length - 1; i >= 0; i--) {
|
|
146
|
+
const element = arr[i];
|
|
147
|
+
callback(element, i, arr);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
126
151
|
function groupBy(arr, getKeyFromItem) {
|
|
127
152
|
const result = {};
|
|
128
153
|
for (let i = 0; i < arr.length; i++) {
|
|
@@ -214,6 +239,21 @@ function minBy(items, getValue) {
|
|
|
214
239
|
return minElement;
|
|
215
240
|
}
|
|
216
241
|
|
|
242
|
+
function partition(arr, isInTruthy) {
|
|
243
|
+
const truthy = [];
|
|
244
|
+
const falsy = [];
|
|
245
|
+
for (let i = 0; i < arr.length; i++) {
|
|
246
|
+
const item = arr[i];
|
|
247
|
+
if (isInTruthy(item)) {
|
|
248
|
+
truthy.push(item);
|
|
249
|
+
}
|
|
250
|
+
else {
|
|
251
|
+
falsy.push(item);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
return [truthy, falsy];
|
|
255
|
+
}
|
|
256
|
+
|
|
217
257
|
function pull(arr, valuesToRemove) {
|
|
218
258
|
const valuesSet = new Set(valuesToRemove);
|
|
219
259
|
let resultIndex = 0;
|
|
@@ -231,6 +271,15 @@ function pull(arr, valuesToRemove) {
|
|
|
231
271
|
return arr;
|
|
232
272
|
}
|
|
233
273
|
|
|
274
|
+
function pullAt(arr, indicesToRemove) {
|
|
275
|
+
const removed = at(arr, indicesToRemove);
|
|
276
|
+
const indices = new Set(indicesToRemove.slice().sort((x, y) => y - x));
|
|
277
|
+
for (const index of indices) {
|
|
278
|
+
arr.splice(index, 1);
|
|
279
|
+
}
|
|
280
|
+
return removed;
|
|
281
|
+
}
|
|
282
|
+
|
|
234
283
|
function remove(arr, shouldRemoveElement) {
|
|
235
284
|
const originalArr = arr.slice();
|
|
236
285
|
const removed = [];
|
|
@@ -285,12 +334,43 @@ function tail(arr) {
|
|
|
285
334
|
return arr.slice(1);
|
|
286
335
|
}
|
|
287
336
|
|
|
288
|
-
function
|
|
337
|
+
function isSymbol(value) {
|
|
338
|
+
return typeof value === 'symbol' || value instanceof Symbol;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
function toNumber(value) {
|
|
342
|
+
if (isSymbol(value)) {
|
|
343
|
+
return NaN;
|
|
344
|
+
}
|
|
345
|
+
return Number(value);
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
function toFinite(value) {
|
|
349
|
+
if (!value) {
|
|
350
|
+
return value === 0 ? value : 0;
|
|
351
|
+
}
|
|
352
|
+
value = toNumber(value);
|
|
353
|
+
if (value === Infinity || value === -Infinity) {
|
|
354
|
+
const sign = value < 0 ? -1 : 1;
|
|
355
|
+
return sign * Number.MAX_VALUE;
|
|
356
|
+
}
|
|
357
|
+
return value === value ? value : 0;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
function toInteger(value) {
|
|
361
|
+
const finite = toFinite(value);
|
|
362
|
+
const remainder = finite % 1;
|
|
363
|
+
return remainder ? finite - remainder : finite;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
function take(arr, count, guard) {
|
|
367
|
+
count = guard || count === undefined ? 1 : toInteger(count);
|
|
289
368
|
return arr.slice(0, count);
|
|
290
369
|
}
|
|
291
370
|
|
|
292
|
-
function takeRight(arr, count = 1) {
|
|
293
|
-
|
|
371
|
+
function takeRight(arr, count = 1, guard) {
|
|
372
|
+
count = guard || count === undefined ? 1 : toInteger(count);
|
|
373
|
+
if (count <= 0 || arr == null || arr.length === 0) {
|
|
294
374
|
return [];
|
|
295
375
|
}
|
|
296
376
|
return arr.slice(-count);
|
|
@@ -431,6 +511,27 @@ function zip(...arrs) {
|
|
|
431
511
|
return result;
|
|
432
512
|
}
|
|
433
513
|
|
|
514
|
+
function zipObject(keys, values) {
|
|
515
|
+
const result = {};
|
|
516
|
+
for (let i = 0; i < keys.length; i++) {
|
|
517
|
+
result[keys[i]] = values[i];
|
|
518
|
+
}
|
|
519
|
+
return result;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
function zipWith(arr1, ...rest) {
|
|
523
|
+
const arrs = [arr1, ...rest.slice(0, -1)];
|
|
524
|
+
const combine = rest[rest.length - 1];
|
|
525
|
+
const maxIndex = Math.max(...arrs.map(arr => arr.length));
|
|
526
|
+
const result = Array(maxIndex);
|
|
527
|
+
for (let i = 0; i < maxIndex; i++) {
|
|
528
|
+
const elements = arrs.map(arr => arr[i]);
|
|
529
|
+
result[i] = combine(...elements);
|
|
530
|
+
}
|
|
531
|
+
return result;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
exports.at = at;
|
|
434
535
|
exports.chunk = chunk;
|
|
435
536
|
exports.compact = compact;
|
|
436
537
|
exports.countBy = countBy;
|
|
@@ -442,9 +543,11 @@ exports.dropRight = dropRight;
|
|
|
442
543
|
exports.dropRightWhile = dropRightWhile;
|
|
443
544
|
exports.dropWhile = dropWhile;
|
|
444
545
|
exports.fill = fill;
|
|
546
|
+
exports.flatMap = flatMap;
|
|
445
547
|
exports.flatMapDeep = flatMapDeep;
|
|
446
548
|
exports.flatten = flatten;
|
|
447
549
|
exports.flattenDeep = flattenDeep;
|
|
550
|
+
exports.forEachRight = forEachRight;
|
|
448
551
|
exports.groupBy = groupBy;
|
|
449
552
|
exports.head = head;
|
|
450
553
|
exports.initial = initial;
|
|
@@ -453,11 +556,14 @@ exports.intersectionBy = intersectionBy;
|
|
|
453
556
|
exports.intersectionWith = intersectionWith;
|
|
454
557
|
exports.isSubset = isSubset;
|
|
455
558
|
exports.isSubsetWith = isSubsetWith;
|
|
559
|
+
exports.isSymbol = isSymbol;
|
|
456
560
|
exports.keyBy = keyBy;
|
|
457
561
|
exports.last = last;
|
|
458
562
|
exports.maxBy = maxBy;
|
|
459
563
|
exports.minBy = minBy;
|
|
564
|
+
exports.partition = partition;
|
|
460
565
|
exports.pull = pull;
|
|
566
|
+
exports.pullAt = pullAt;
|
|
461
567
|
exports.remove = remove;
|
|
462
568
|
exports.sample = sample;
|
|
463
569
|
exports.sampleSize = sampleSize;
|
|
@@ -466,6 +572,9 @@ exports.tail = tail;
|
|
|
466
572
|
exports.take = take;
|
|
467
573
|
exports.takeRight = takeRight;
|
|
468
574
|
exports.toFilled = toFilled;
|
|
575
|
+
exports.toFinite = toFinite;
|
|
576
|
+
exports.toInteger = toInteger;
|
|
577
|
+
exports.toNumber = toNumber;
|
|
469
578
|
exports.union = union;
|
|
470
579
|
exports.unionBy = unionBy;
|
|
471
580
|
exports.unionWith = unionWith;
|
|
@@ -480,3 +589,5 @@ exports.xor = xor;
|
|
|
480
589
|
exports.xorBy = xorBy;
|
|
481
590
|
exports.xorWith = xorWith;
|
|
482
591
|
exports.zip = zip;
|
|
592
|
+
exports.zipObject = zipObject;
|
|
593
|
+
exports.zipWith = zipWith;
|
package/dist/array/index.js
CHANGED
|
@@ -2,32 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
function at(arr, indices) {
|
|
8
|
-
const result = new Array(indices.length);
|
|
9
|
-
const length = arr.length;
|
|
10
|
-
for (let i = 0; i < indices.length; i++) {
|
|
11
|
-
let index = indices[i];
|
|
12
|
-
index = Number.isInteger(index) ? index : Math.trunc(index) || 0;
|
|
13
|
-
if (index < 0) {
|
|
14
|
-
index += length;
|
|
15
|
-
}
|
|
16
|
-
result[i] = arr[index];
|
|
17
|
-
}
|
|
18
|
-
return result;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function flatMap(arr, iteratee, depth = 1) {
|
|
22
|
-
return zip.flatten(arr.map(item => iteratee(item)), depth);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function forEachRight(arr, callback) {
|
|
26
|
-
for (let i = arr.length - 1; i >= 0; i--) {
|
|
27
|
-
const element = arr[i];
|
|
28
|
-
callback(element, i, arr);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
5
|
+
const zipWith = require('../_chunk/zipWith-CsbMsR.js');
|
|
31
6
|
|
|
32
7
|
function compareValues(a, b, order) {
|
|
33
8
|
if (a < b) {
|
|
@@ -57,30 +32,6 @@ function orderBy(arr, criteria, orders) {
|
|
|
57
32
|
});
|
|
58
33
|
}
|
|
59
34
|
|
|
60
|
-
function partition(arr, isInTruthy) {
|
|
61
|
-
const truthy = [];
|
|
62
|
-
const falsy = [];
|
|
63
|
-
for (let i = 0; i < arr.length; i++) {
|
|
64
|
-
const item = arr[i];
|
|
65
|
-
if (isInTruthy(item)) {
|
|
66
|
-
truthy.push(item);
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
falsy.push(item);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
return [truthy, falsy];
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
function pullAt(arr, indicesToRemove) {
|
|
76
|
-
const removed = at(arr, indicesToRemove);
|
|
77
|
-
const indices = new Set(indicesToRemove.slice().sort((x, y) => y - x));
|
|
78
|
-
for (const index of indices) {
|
|
79
|
-
arr.splice(index, 1);
|
|
80
|
-
}
|
|
81
|
-
return removed;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
35
|
function sortBy(arr, criteria) {
|
|
85
36
|
return orderBy(arr, criteria, ['asc']);
|
|
86
37
|
}
|
|
@@ -106,83 +57,63 @@ function takeWhile(arr, shouldContinueTaking) {
|
|
|
106
57
|
return result;
|
|
107
58
|
}
|
|
108
59
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
exports.
|
|
130
|
-
exports.
|
|
131
|
-
exports.
|
|
132
|
-
exports.
|
|
133
|
-
exports.
|
|
134
|
-
exports.
|
|
135
|
-
exports.
|
|
136
|
-
exports.
|
|
137
|
-
exports.
|
|
138
|
-
exports.
|
|
139
|
-
exports.
|
|
140
|
-
exports.
|
|
141
|
-
exports.
|
|
142
|
-
exports.
|
|
143
|
-
exports.
|
|
144
|
-
exports.
|
|
145
|
-
exports.
|
|
146
|
-
exports.
|
|
147
|
-
exports.
|
|
148
|
-
exports.
|
|
149
|
-
exports.
|
|
150
|
-
exports.
|
|
151
|
-
exports.
|
|
152
|
-
exports.
|
|
153
|
-
exports.
|
|
154
|
-
exports.
|
|
155
|
-
exports.
|
|
156
|
-
exports.
|
|
157
|
-
exports.
|
|
158
|
-
exports.
|
|
159
|
-
exports.
|
|
160
|
-
exports.
|
|
161
|
-
exports.
|
|
162
|
-
exports.
|
|
163
|
-
exports.
|
|
164
|
-
exports.
|
|
165
|
-
exports.unionBy = zip.unionBy;
|
|
166
|
-
exports.unionWith = zip.unionWith;
|
|
167
|
-
exports.uniq = zip.uniq;
|
|
168
|
-
exports.uniqBy = zip.uniqBy;
|
|
169
|
-
exports.uniqWith = zip.uniqWith;
|
|
170
|
-
exports.unzip = zip.unzip;
|
|
171
|
-
exports.unzipWith = zip.unzipWith;
|
|
172
|
-
exports.windowed = zip.windowed;
|
|
173
|
-
exports.without = zip.without;
|
|
174
|
-
exports.xor = zip.xor;
|
|
175
|
-
exports.xorBy = zip.xorBy;
|
|
176
|
-
exports.xorWith = zip.xorWith;
|
|
177
|
-
exports.zip = zip.zip;
|
|
178
|
-
exports.at = at;
|
|
179
|
-
exports.flatMap = flatMap;
|
|
180
|
-
exports.forEachRight = forEachRight;
|
|
60
|
+
exports.at = zipWith.at;
|
|
61
|
+
exports.chunk = zipWith.chunk;
|
|
62
|
+
exports.compact = zipWith.compact;
|
|
63
|
+
exports.countBy = zipWith.countBy;
|
|
64
|
+
exports.difference = zipWith.difference;
|
|
65
|
+
exports.differenceBy = zipWith.differenceBy;
|
|
66
|
+
exports.differenceWith = zipWith.differenceWith;
|
|
67
|
+
exports.drop = zipWith.drop;
|
|
68
|
+
exports.dropRight = zipWith.dropRight;
|
|
69
|
+
exports.dropRightWhile = zipWith.dropRightWhile;
|
|
70
|
+
exports.dropWhile = zipWith.dropWhile;
|
|
71
|
+
exports.fill = zipWith.fill;
|
|
72
|
+
exports.flatMap = zipWith.flatMap;
|
|
73
|
+
exports.flatMapDeep = zipWith.flatMapDeep;
|
|
74
|
+
exports.flatten = zipWith.flatten;
|
|
75
|
+
exports.flattenDeep = zipWith.flattenDeep;
|
|
76
|
+
exports.forEachRight = zipWith.forEachRight;
|
|
77
|
+
exports.groupBy = zipWith.groupBy;
|
|
78
|
+
exports.head = zipWith.head;
|
|
79
|
+
exports.initial = zipWith.initial;
|
|
80
|
+
exports.intersection = zipWith.intersection;
|
|
81
|
+
exports.intersectionBy = zipWith.intersectionBy;
|
|
82
|
+
exports.intersectionWith = zipWith.intersectionWith;
|
|
83
|
+
exports.isSubset = zipWith.isSubset;
|
|
84
|
+
exports.isSubsetWith = zipWith.isSubsetWith;
|
|
85
|
+
exports.keyBy = zipWith.keyBy;
|
|
86
|
+
exports.last = zipWith.last;
|
|
87
|
+
exports.maxBy = zipWith.maxBy;
|
|
88
|
+
exports.minBy = zipWith.minBy;
|
|
89
|
+
exports.partition = zipWith.partition;
|
|
90
|
+
exports.pull = zipWith.pull;
|
|
91
|
+
exports.pullAt = zipWith.pullAt;
|
|
92
|
+
exports.remove = zipWith.remove;
|
|
93
|
+
exports.sample = zipWith.sample;
|
|
94
|
+
exports.sampleSize = zipWith.sampleSize;
|
|
95
|
+
exports.shuffle = zipWith.shuffle;
|
|
96
|
+
exports.tail = zipWith.tail;
|
|
97
|
+
exports.take = zipWith.take;
|
|
98
|
+
exports.takeRight = zipWith.takeRight;
|
|
99
|
+
exports.toFilled = zipWith.toFilled;
|
|
100
|
+
exports.union = zipWith.union;
|
|
101
|
+
exports.unionBy = zipWith.unionBy;
|
|
102
|
+
exports.unionWith = zipWith.unionWith;
|
|
103
|
+
exports.uniq = zipWith.uniq;
|
|
104
|
+
exports.uniqBy = zipWith.uniqBy;
|
|
105
|
+
exports.uniqWith = zipWith.uniqWith;
|
|
106
|
+
exports.unzip = zipWith.unzip;
|
|
107
|
+
exports.unzipWith = zipWith.unzipWith;
|
|
108
|
+
exports.windowed = zipWith.windowed;
|
|
109
|
+
exports.without = zipWith.without;
|
|
110
|
+
exports.xor = zipWith.xor;
|
|
111
|
+
exports.xorBy = zipWith.xorBy;
|
|
112
|
+
exports.xorWith = zipWith.xorWith;
|
|
113
|
+
exports.zip = zipWith.zip;
|
|
114
|
+
exports.zipObject = zipWith.zipObject;
|
|
115
|
+
exports.zipWith = zipWith.zipWith;
|
|
181
116
|
exports.orderBy = orderBy;
|
|
182
|
-
exports.partition = partition;
|
|
183
|
-
exports.pullAt = pullAt;
|
|
184
117
|
exports.sortBy = sortBy;
|
|
185
118
|
exports.takeRightWhile = takeRightWhile;
|
|
186
119
|
exports.takeWhile = takeWhile;
|
|
187
|
-
exports.zipObject = zipObject;
|
|
188
|
-
exports.zipWith = zipWith;
|
package/dist/array/take.d.mts
CHANGED
package/dist/array/take.d.ts
CHANGED
package/dist/array/take.mjs
CHANGED
package/dist/array/takeRight.mjs
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { toInteger } from '../compat/util/toInteger.mjs';
|
|
2
|
+
|
|
3
|
+
function takeRight(arr, count = 1, guard) {
|
|
4
|
+
count = guard || count === undefined ? 1 : toInteger(count);
|
|
5
|
+
if (count <= 0 || arr == null || arr.length === 0) {
|
|
3
6
|
return [];
|
|
4
7
|
}
|
|
5
8
|
return arr.slice(-count);
|