es-toolkit 1.21.0 → 1.22.0-dev.688
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/{rest-pUyjvl.js → flowRight-BzdOZX.js} +16 -0
- package/dist/_chunk/{isWeakSet-1xFSnK.js → isWeakSet-clQklw.js} +10 -0
- package/dist/_chunk/pad-Cw2pvt.js +207 -0
- package/dist/_chunk/{toMerged-D-sLFv.js → toMerged-2WPeoI.js} +5 -2
- package/dist/_chunk/{zipWith-DEcUS4.js → zipWith-EOU_KZ.js} +1 -1
- package/dist/array/dropWhile.d.mts +1 -1
- package/dist/array/dropWhile.d.ts +1 -1
- package/dist/array/dropWhile.mjs +1 -1
- package/dist/array/index.js +1 -1
- package/dist/browser.global.js +1 -1
- package/dist/browser.global.js.map +1 -1
- package/dist/compat/array/dropWhile.d.mts +40 -0
- package/dist/compat/array/dropWhile.d.ts +40 -0
- package/dist/compat/array/dropWhile.mjs +27 -0
- package/dist/compat/array/every.d.mts +139 -0
- package/dist/compat/array/every.d.ts +139 -0
- package/dist/compat/array/every.mjs +49 -0
- package/dist/compat/array/filter.d.mts +118 -0
- package/dist/compat/array/filter.d.ts +118 -0
- package/dist/compat/array/filter.mjs +27 -0
- package/dist/compat/array/find.d.mts +1 -1
- package/dist/compat/array/find.d.ts +1 -1
- package/dist/compat/array/includes.d.mts +62 -0
- package/dist/compat/array/includes.d.ts +62 -0
- package/dist/compat/array/includes.mjs +42 -0
- package/dist/compat/function/flip.d.mts +20 -0
- package/dist/compat/function/flip.d.ts +20 -0
- package/dist/compat/function/flip.mjs +7 -0
- package/dist/compat/index.d.mts +9 -1
- package/dist/compat/index.d.ts +9 -1
- package/dist/compat/index.js +247 -97
- package/dist/compat/index.mjs +9 -1
- package/dist/compat/string/startCase.mjs +16 -2
- package/dist/compat/util/toInteger.d.mts +3 -0
- package/dist/compat/util/toInteger.d.ts +3 -0
- package/dist/function/flow.d.mts +132 -0
- package/dist/function/flow.d.ts +132 -0
- package/dist/function/flow.mjs +11 -0
- package/dist/function/flowRight.d.mts +144 -0
- package/dist/function/flowRight.d.ts +144 -0
- package/dist/function/flowRight.mjs +7 -0
- package/dist/function/index.d.mts +2 -0
- package/dist/function/index.d.ts +2 -0
- package/dist/function/index.js +17 -14
- package/dist/function/index.mjs +2 -0
- package/dist/function/throttle.mjs +1 -0
- package/dist/index.d.mts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +39 -34
- package/dist/index.mjs +4 -0
- package/dist/object/clone.mjs +4 -1
- package/dist/object/cloneDeep.mjs +1 -1
- package/dist/object/index.js +1 -1
- package/dist/predicate/index.d.mts +2 -0
- package/dist/predicate/index.d.ts +2 -0
- package/dist/predicate/index.js +3 -1
- package/dist/predicate/index.mjs +2 -0
- package/dist/predicate/isMap.d.mts +20 -0
- package/dist/predicate/isMap.d.ts +20 -0
- package/dist/predicate/isMap.mjs +5 -0
- package/dist/predicate/isSet.d.mts +20 -0
- package/dist/predicate/isSet.d.ts +20 -0
- package/dist/predicate/isSet.mjs +5 -0
- package/dist/string/index.js +20 -204
- package/package.json +2 -2
package/dist/compat/index.js
CHANGED
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
const zipWith = require('../_chunk/zipWith-
|
|
5
|
+
const zipWith = require('../_chunk/zipWith-EOU_KZ.js');
|
|
6
6
|
const promise_index = require('../_chunk/index-BGZDR9.js');
|
|
7
|
-
const
|
|
7
|
+
const flowRight = require('../_chunk/flowRight-BzdOZX.js');
|
|
8
8
|
const range = require('../_chunk/range-BXlMmn.js');
|
|
9
9
|
const randomInt = require('../_chunk/randomInt-CF7bZK.js');
|
|
10
|
-
const toMerged = require('../_chunk/toMerged-
|
|
10
|
+
const toMerged = require('../_chunk/toMerged-2WPeoI.js');
|
|
11
11
|
const isPlainObject$1 = require('../_chunk/isPlainObject-BIekvL.js');
|
|
12
|
-
const isWeakSet$1 = require('../_chunk/isWeakSet-
|
|
13
|
-
const
|
|
12
|
+
const isWeakSet$1 = require('../_chunk/isWeakSet-clQklw.js');
|
|
13
|
+
const pad$1 = require('../_chunk/pad-Cw2pvt.js');
|
|
14
14
|
|
|
15
15
|
function castArray(value) {
|
|
16
16
|
if (arguments.length === 0) {
|
|
@@ -45,18 +45,6 @@ function drop(collection, itemsCount) {
|
|
|
45
45
|
return collection.slice(itemsCount);
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
function fill(array, value, start = 0, end = array.length) {
|
|
49
|
-
start = Math.floor(start);
|
|
50
|
-
end = Math.floor(end);
|
|
51
|
-
if (!start) {
|
|
52
|
-
start = 0;
|
|
53
|
-
}
|
|
54
|
-
if (!end) {
|
|
55
|
-
end = 0;
|
|
56
|
-
}
|
|
57
|
-
return zipWith.fill(array, value, start, end);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
48
|
function isDeepKey(key) {
|
|
61
49
|
switch (typeof key) {
|
|
62
50
|
case 'number':
|
|
@@ -380,6 +368,86 @@ function matchesProperty(property, source) {
|
|
|
380
368
|
};
|
|
381
369
|
}
|
|
382
370
|
|
|
371
|
+
function dropWhile(arr, predicate) {
|
|
372
|
+
switch (typeof predicate) {
|
|
373
|
+
case 'function': {
|
|
374
|
+
return zipWith.dropWhile(arr, (item, index, arr) => Boolean(predicate(item, index, arr)));
|
|
375
|
+
}
|
|
376
|
+
case 'object': {
|
|
377
|
+
if (Array.isArray(predicate) && predicate.length === 2) {
|
|
378
|
+
const key = predicate[0];
|
|
379
|
+
const value = predicate[1];
|
|
380
|
+
return zipWith.dropWhile(arr, matchesProperty(key, value));
|
|
381
|
+
}
|
|
382
|
+
else {
|
|
383
|
+
return zipWith.dropWhile(arr, matches(predicate));
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
case 'string': {
|
|
387
|
+
return zipWith.dropWhile(arr, property(predicate));
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
function identity(x) {
|
|
393
|
+
return x;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
function every(source, doesMatch) {
|
|
397
|
+
if (!source) {
|
|
398
|
+
source = [];
|
|
399
|
+
}
|
|
400
|
+
let values = source;
|
|
401
|
+
if (!Array.isArray(source)) {
|
|
402
|
+
values = Object.values(source);
|
|
403
|
+
}
|
|
404
|
+
if (!doesMatch) {
|
|
405
|
+
doesMatch = identity;
|
|
406
|
+
}
|
|
407
|
+
switch (typeof doesMatch) {
|
|
408
|
+
case 'function': {
|
|
409
|
+
if (!Array.isArray(source)) {
|
|
410
|
+
const entries = Object.entries(source);
|
|
411
|
+
for (let i = 0; i < entries.length; i++) {
|
|
412
|
+
const entry = entries[i];
|
|
413
|
+
const key = entry[0];
|
|
414
|
+
const value = entry[1];
|
|
415
|
+
if (!doesMatch(value, key, source)) {
|
|
416
|
+
return false;
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
return true;
|
|
420
|
+
}
|
|
421
|
+
return values.every(doesMatch);
|
|
422
|
+
}
|
|
423
|
+
case 'object': {
|
|
424
|
+
if (Array.isArray(doesMatch) && doesMatch.length === 2) {
|
|
425
|
+
const key = doesMatch[0];
|
|
426
|
+
const value = doesMatch[1];
|
|
427
|
+
return values.every(matchesProperty(key, value));
|
|
428
|
+
}
|
|
429
|
+
else {
|
|
430
|
+
return values.every(matches(doesMatch));
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
case 'string': {
|
|
434
|
+
return values.every(property(doesMatch));
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
function fill(array, value, start = 0, end = array.length) {
|
|
440
|
+
start = Math.floor(start);
|
|
441
|
+
end = Math.floor(end);
|
|
442
|
+
if (!start) {
|
|
443
|
+
start = 0;
|
|
444
|
+
}
|
|
445
|
+
if (!end) {
|
|
446
|
+
end = 0;
|
|
447
|
+
}
|
|
448
|
+
return zipWith.fill(array, value, start, end);
|
|
449
|
+
}
|
|
450
|
+
|
|
383
451
|
function find(source, doesMatch) {
|
|
384
452
|
let values = source;
|
|
385
453
|
if (!Array.isArray(source)) {
|
|
@@ -503,6 +571,77 @@ function flattenDepth(value, depth = 1) {
|
|
|
503
571
|
return flatten(value, depth);
|
|
504
572
|
}
|
|
505
573
|
|
|
574
|
+
function isString(value) {
|
|
575
|
+
return typeof value === 'string' || value instanceof String;
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
function isSymbol(value) {
|
|
579
|
+
return typeof value === 'symbol' || value instanceof Symbol;
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
function toNumber(value) {
|
|
583
|
+
if (isSymbol(value)) {
|
|
584
|
+
return NaN;
|
|
585
|
+
}
|
|
586
|
+
return Number(value);
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
function toFinite(value) {
|
|
590
|
+
if (!value) {
|
|
591
|
+
return value === 0 ? value : 0;
|
|
592
|
+
}
|
|
593
|
+
value = toNumber(value);
|
|
594
|
+
if (value === Infinity || value === -Infinity) {
|
|
595
|
+
const sign = value < 0 ? -1 : 1;
|
|
596
|
+
return sign * Number.MAX_VALUE;
|
|
597
|
+
}
|
|
598
|
+
return value === value ? value : 0;
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
function toInteger(value) {
|
|
602
|
+
const finite = toFinite(value);
|
|
603
|
+
const remainder = finite % 1;
|
|
604
|
+
return remainder ? finite - remainder : finite;
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
function includes(source, target, fromIndex, guard) {
|
|
608
|
+
if (source == null) {
|
|
609
|
+
return false;
|
|
610
|
+
}
|
|
611
|
+
if (guard || !fromIndex) {
|
|
612
|
+
fromIndex = 0;
|
|
613
|
+
}
|
|
614
|
+
else {
|
|
615
|
+
fromIndex = toInteger(fromIndex);
|
|
616
|
+
}
|
|
617
|
+
if (isString(source)) {
|
|
618
|
+
if (fromIndex > source.length || target instanceof RegExp) {
|
|
619
|
+
return false;
|
|
620
|
+
}
|
|
621
|
+
if (fromIndex < 0) {
|
|
622
|
+
fromIndex = Math.max(0, source.length + fromIndex);
|
|
623
|
+
}
|
|
624
|
+
return source.includes(target, fromIndex);
|
|
625
|
+
}
|
|
626
|
+
if (Array.isArray(source)) {
|
|
627
|
+
return source.includes(target, fromIndex);
|
|
628
|
+
}
|
|
629
|
+
const keys = [];
|
|
630
|
+
for (const key in source) {
|
|
631
|
+
keys.push(key);
|
|
632
|
+
}
|
|
633
|
+
if (fromIndex < 0) {
|
|
634
|
+
fromIndex = Math.max(0, keys.length + fromIndex);
|
|
635
|
+
}
|
|
636
|
+
for (let i = fromIndex; i < keys.length; i++) {
|
|
637
|
+
const value = Reflect.get(source, keys[i]);
|
|
638
|
+
if (value === target || (Number.isNaN(value) && Number.isNaN(target))) {
|
|
639
|
+
return true;
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
return false;
|
|
643
|
+
}
|
|
644
|
+
|
|
506
645
|
function indexOf(array, searchElement, fromIndex) {
|
|
507
646
|
if (array == null) {
|
|
508
647
|
return -1;
|
|
@@ -561,10 +700,6 @@ const compareValues = (a, b, order) => {
|
|
|
561
700
|
return 0;
|
|
562
701
|
};
|
|
563
702
|
|
|
564
|
-
function isSymbol(value) {
|
|
565
|
-
return typeof value === 'symbol' || value instanceof Symbol;
|
|
566
|
-
}
|
|
567
|
-
|
|
568
703
|
const regexIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;
|
|
569
704
|
const regexIsPlainProp = /^\w*$/;
|
|
570
705
|
function isKey(value, object) {
|
|
@@ -661,10 +796,6 @@ function size(target) {
|
|
|
661
796
|
return Object.keys(target).length;
|
|
662
797
|
}
|
|
663
798
|
|
|
664
|
-
function identity(x) {
|
|
665
|
-
return x;
|
|
666
|
-
}
|
|
667
|
-
|
|
668
799
|
function some(arr, predicate, guard) {
|
|
669
800
|
if (guard != null) {
|
|
670
801
|
predicate = undefined;
|
|
@@ -723,6 +854,30 @@ function zipObjectDeep(keys, values) {
|
|
|
723
854
|
return result;
|
|
724
855
|
}
|
|
725
856
|
|
|
857
|
+
function isArray(value) {
|
|
858
|
+
return Array.isArray(value);
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
function filter(source, predicate) {
|
|
862
|
+
if (!predicate) {
|
|
863
|
+
predicate = identity;
|
|
864
|
+
}
|
|
865
|
+
const collection = isArray(source) ? source : Object.values(source);
|
|
866
|
+
switch (typeof predicate) {
|
|
867
|
+
case 'function': {
|
|
868
|
+
return collection.filter(predicate);
|
|
869
|
+
}
|
|
870
|
+
case 'object': {
|
|
871
|
+
return isArray(predicate)
|
|
872
|
+
? collection.filter(matchesProperty(predicate[0], predicate[1]))
|
|
873
|
+
: collection.filter(matches(predicate));
|
|
874
|
+
}
|
|
875
|
+
case 'string': {
|
|
876
|
+
return collection.filter(property(predicate));
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
|
|
726
881
|
function ary(func, n = func.length, guard) {
|
|
727
882
|
if (guard) {
|
|
728
883
|
n = func.length;
|
|
@@ -730,7 +885,7 @@ function ary(func, n = func.length, guard) {
|
|
|
730
885
|
if (Number.isNaN(n) || n < 0) {
|
|
731
886
|
n = 0;
|
|
732
887
|
}
|
|
733
|
-
return
|
|
888
|
+
return flowRight.ary(func, n);
|
|
734
889
|
}
|
|
735
890
|
|
|
736
891
|
function bind(func, thisObj, ...partialArgs) {
|
|
@@ -797,7 +952,7 @@ function rest(func, start = func.length - 1) {
|
|
|
797
952
|
if (Number.isNaN(start) || start < 0) {
|
|
798
953
|
start = func.length - 1;
|
|
799
954
|
}
|
|
800
|
-
return
|
|
955
|
+
return flowRight.rest(func, start);
|
|
801
956
|
}
|
|
802
957
|
|
|
803
958
|
function spread(func, argsIndex = 0) {
|
|
@@ -905,7 +1060,7 @@ function debounce(func, debounceMs = 0, options = {}) {
|
|
|
905
1060
|
}
|
|
906
1061
|
let result = undefined;
|
|
907
1062
|
let pendingAt = null;
|
|
908
|
-
const _debounced =
|
|
1063
|
+
const _debounced = flowRight.debounce(function (...args) {
|
|
909
1064
|
result = func.apply(this, args);
|
|
910
1065
|
pendingAt = null;
|
|
911
1066
|
}, debounceMs, { signal, edges });
|
|
@@ -944,6 +1099,12 @@ function throttle(func, throttleMs = 0, options = {}) {
|
|
|
944
1099
|
return debounce(func, throttleMs, { leading, trailing, signal, maxWait: throttleMs });
|
|
945
1100
|
}
|
|
946
1101
|
|
|
1102
|
+
function flip(func) {
|
|
1103
|
+
return function (...args) {
|
|
1104
|
+
return func.apply(this, args.reverse());
|
|
1105
|
+
};
|
|
1106
|
+
}
|
|
1107
|
+
|
|
947
1108
|
function isNil(x) {
|
|
948
1109
|
return x == null;
|
|
949
1110
|
}
|
|
@@ -1211,7 +1372,7 @@ function mergeWithDeep(target, source, merge, stack) {
|
|
|
1211
1372
|
}
|
|
1212
1373
|
|
|
1213
1374
|
function merge(object, ...sources) {
|
|
1214
|
-
return mergeWith(object, ...sources,
|
|
1375
|
+
return mergeWith(object, ...sources, flowRight.noop);
|
|
1215
1376
|
}
|
|
1216
1377
|
|
|
1217
1378
|
function isArrayLike(value) {
|
|
@@ -1229,10 +1390,6 @@ function fromPairs(pairs) {
|
|
|
1229
1390
|
return result;
|
|
1230
1391
|
}
|
|
1231
1392
|
|
|
1232
|
-
function isArray(value) {
|
|
1233
|
-
return Array.isArray(value);
|
|
1234
|
-
}
|
|
1235
|
-
|
|
1236
1393
|
function isObject(value) {
|
|
1237
1394
|
return value !== null && (typeof value === 'object' || typeof value === 'function');
|
|
1238
1395
|
}
|
|
@@ -1253,10 +1410,6 @@ function isRegExp(value) {
|
|
|
1253
1410
|
return isWeakSet$1.isRegExp(value);
|
|
1254
1411
|
}
|
|
1255
1412
|
|
|
1256
|
-
function isString(value) {
|
|
1257
|
-
return typeof value === 'string' || value instanceof String;
|
|
1258
|
-
}
|
|
1259
|
-
|
|
1260
1413
|
function isWeakMap(value) {
|
|
1261
1414
|
return isWeakSet$1.isWeakMap(value);
|
|
1262
1415
|
}
|
|
@@ -1333,27 +1486,41 @@ function normalizeForCase(str) {
|
|
|
1333
1486
|
}
|
|
1334
1487
|
|
|
1335
1488
|
function camelCase(str) {
|
|
1336
|
-
return
|
|
1489
|
+
return pad$1.camelCase(normalizeForCase(str));
|
|
1337
1490
|
}
|
|
1338
1491
|
|
|
1339
1492
|
function kebabCase(str) {
|
|
1340
|
-
return
|
|
1493
|
+
return pad$1.kebabCase(normalizeForCase(str));
|
|
1341
1494
|
}
|
|
1342
1495
|
|
|
1343
1496
|
function snakeCase(str) {
|
|
1344
|
-
return
|
|
1497
|
+
return pad$1.snakeCase(normalizeForCase(str));
|
|
1345
1498
|
}
|
|
1346
1499
|
|
|
1347
1500
|
function startCase(str) {
|
|
1348
|
-
|
|
1501
|
+
const words = pad$1.getWords(normalizeForCase(str).trim());
|
|
1502
|
+
let result = '';
|
|
1503
|
+
for (let i = 0; i < words.length; i++) {
|
|
1504
|
+
const word = words[i];
|
|
1505
|
+
if (result) {
|
|
1506
|
+
result += ' ';
|
|
1507
|
+
}
|
|
1508
|
+
if (word === word.toUpperCase()) {
|
|
1509
|
+
result += word;
|
|
1510
|
+
}
|
|
1511
|
+
else {
|
|
1512
|
+
result += word[0].toUpperCase() + word.slice(1).toLowerCase();
|
|
1513
|
+
}
|
|
1514
|
+
}
|
|
1515
|
+
return result;
|
|
1349
1516
|
}
|
|
1350
1517
|
|
|
1351
1518
|
function lowerCase(str) {
|
|
1352
|
-
return
|
|
1519
|
+
return pad$1.lowerCase(normalizeForCase(str));
|
|
1353
1520
|
}
|
|
1354
1521
|
|
|
1355
1522
|
function upperCase(str) {
|
|
1356
|
-
return
|
|
1523
|
+
return pad$1.upperCase(normalizeForCase(str));
|
|
1357
1524
|
}
|
|
1358
1525
|
|
|
1359
1526
|
function startsWith(str, target, position = 0) {
|
|
@@ -1365,7 +1532,7 @@ function endsWith(str, target, position = str.length) {
|
|
|
1365
1532
|
}
|
|
1366
1533
|
|
|
1367
1534
|
function pad(str, length, chars = ' ') {
|
|
1368
|
-
return
|
|
1535
|
+
return pad$1.pad(toString(str), length, chars);
|
|
1369
1536
|
}
|
|
1370
1537
|
|
|
1371
1538
|
function padStart(str, length = 0, chars = ' ') {
|
|
@@ -1389,14 +1556,14 @@ function trim(str, chars, guard) {
|
|
|
1389
1556
|
}
|
|
1390
1557
|
switch (typeof chars) {
|
|
1391
1558
|
case 'string': {
|
|
1392
|
-
return
|
|
1559
|
+
return pad$1.trim(str, chars.toString().split(''));
|
|
1393
1560
|
}
|
|
1394
1561
|
case 'object': {
|
|
1395
1562
|
if (Array.isArray(chars)) {
|
|
1396
|
-
return
|
|
1563
|
+
return pad$1.trim(str, chars.map(x => x.toString()));
|
|
1397
1564
|
}
|
|
1398
1565
|
else {
|
|
1399
|
-
return
|
|
1566
|
+
return pad$1.trim(str, chars.toString().split(''));
|
|
1400
1567
|
}
|
|
1401
1568
|
}
|
|
1402
1569
|
}
|
|
@@ -1411,14 +1578,14 @@ function trimStart(str, chars, guard) {
|
|
|
1411
1578
|
}
|
|
1412
1579
|
switch (typeof chars) {
|
|
1413
1580
|
case 'string': {
|
|
1414
|
-
return
|
|
1581
|
+
return pad$1.trimStart(str, chars.toString().split(''));
|
|
1415
1582
|
}
|
|
1416
1583
|
case 'object': {
|
|
1417
1584
|
if (Array.isArray(chars)) {
|
|
1418
|
-
return
|
|
1585
|
+
return pad$1.trimStart(str, chars.map(x => x.toString()));
|
|
1419
1586
|
}
|
|
1420
1587
|
else {
|
|
1421
|
-
return
|
|
1588
|
+
return pad$1.trimStart(str, chars.toString().split(''));
|
|
1422
1589
|
}
|
|
1423
1590
|
}
|
|
1424
1591
|
}
|
|
@@ -1433,14 +1600,14 @@ function trimEnd(str, chars, guard) {
|
|
|
1433
1600
|
}
|
|
1434
1601
|
switch (typeof chars) {
|
|
1435
1602
|
case 'string': {
|
|
1436
|
-
return
|
|
1603
|
+
return pad$1.trimEnd(str, chars.toString().split(''));
|
|
1437
1604
|
}
|
|
1438
1605
|
case 'object': {
|
|
1439
1606
|
if (Array.isArray(chars)) {
|
|
1440
|
-
return
|
|
1607
|
+
return pad$1.trimEnd(str, chars.map(x => x.toString()));
|
|
1441
1608
|
}
|
|
1442
1609
|
else {
|
|
1443
|
-
return
|
|
1610
|
+
return pad$1.trimEnd(str, chars.toString().split(''));
|
|
1444
1611
|
}
|
|
1445
1612
|
}
|
|
1446
1613
|
}
|
|
@@ -1609,31 +1776,6 @@ function random(...args) {
|
|
|
1609
1776
|
}
|
|
1610
1777
|
}
|
|
1611
1778
|
|
|
1612
|
-
function toNumber(value) {
|
|
1613
|
-
if (isSymbol(value)) {
|
|
1614
|
-
return NaN;
|
|
1615
|
-
}
|
|
1616
|
-
return Number(value);
|
|
1617
|
-
}
|
|
1618
|
-
|
|
1619
|
-
function toFinite(value) {
|
|
1620
|
-
if (!value) {
|
|
1621
|
-
return value === 0 ? value : 0;
|
|
1622
|
-
}
|
|
1623
|
-
value = toNumber(value);
|
|
1624
|
-
if (value === Infinity || value === -Infinity) {
|
|
1625
|
-
const sign = value < 0 ? -1 : 1;
|
|
1626
|
-
return sign * Number.MAX_VALUE;
|
|
1627
|
-
}
|
|
1628
|
-
return value === value ? value : 0;
|
|
1629
|
-
}
|
|
1630
|
-
|
|
1631
|
-
function toInteger(value) {
|
|
1632
|
-
const finite = toFinite(value);
|
|
1633
|
-
const remainder = finite % 1;
|
|
1634
|
-
return remainder ? finite - remainder : finite;
|
|
1635
|
-
}
|
|
1636
|
-
|
|
1637
1779
|
exports.at = zipWith.at;
|
|
1638
1780
|
exports.compact = zipWith.compact;
|
|
1639
1781
|
exports.countBy = zipWith.countBy;
|
|
@@ -1641,7 +1783,6 @@ exports.differenceBy = zipWith.differenceBy;
|
|
|
1641
1783
|
exports.differenceWith = zipWith.differenceWith;
|
|
1642
1784
|
exports.dropRight = zipWith.dropRight;
|
|
1643
1785
|
exports.dropRightWhile = zipWith.dropRightWhile;
|
|
1644
|
-
exports.dropWhile = zipWith.dropWhile;
|
|
1645
1786
|
exports.first = zipWith.head;
|
|
1646
1787
|
exports.flatMap = zipWith.flatMap;
|
|
1647
1788
|
exports.flatMapDeep = zipWith.flatMapDeep;
|
|
@@ -1688,15 +1829,17 @@ exports.TimeoutError = promise_index.TimeoutError;
|
|
|
1688
1829
|
exports.delay = promise_index.delay;
|
|
1689
1830
|
exports.timeout = promise_index.timeout;
|
|
1690
1831
|
exports.withTimeout = promise_index.withTimeout;
|
|
1691
|
-
exports.after =
|
|
1692
|
-
exports.before =
|
|
1693
|
-
exports.
|
|
1694
|
-
exports.
|
|
1695
|
-
exports.
|
|
1696
|
-
exports.
|
|
1697
|
-
exports.
|
|
1698
|
-
exports.
|
|
1699
|
-
exports.
|
|
1832
|
+
exports.after = flowRight.after;
|
|
1833
|
+
exports.before = flowRight.before;
|
|
1834
|
+
exports.flow = flowRight.flow;
|
|
1835
|
+
exports.flowRight = flowRight.flowRight;
|
|
1836
|
+
exports.memoize = flowRight.memoize;
|
|
1837
|
+
exports.negate = flowRight.negate;
|
|
1838
|
+
exports.noop = flowRight.noop;
|
|
1839
|
+
exports.once = flowRight.once;
|
|
1840
|
+
exports.partial = flowRight.partial;
|
|
1841
|
+
exports.partialRight = flowRight.partialRight;
|
|
1842
|
+
exports.unary = flowRight.unary;
|
|
1700
1843
|
exports.mean = range.mean;
|
|
1701
1844
|
exports.meanBy = range.meanBy;
|
|
1702
1845
|
exports.range = range.range;
|
|
@@ -1715,18 +1858,20 @@ exports.isDate = isWeakSet$1.isDate;
|
|
|
1715
1858
|
exports.isEqual = isWeakSet$1.isEqual;
|
|
1716
1859
|
exports.isFunction = isWeakSet$1.isFunction;
|
|
1717
1860
|
exports.isLength = isWeakSet$1.isLength;
|
|
1861
|
+
exports.isMap = isWeakSet$1.isMap;
|
|
1718
1862
|
exports.isNotNil = isWeakSet$1.isNotNil;
|
|
1719
1863
|
exports.isNull = isWeakSet$1.isNull;
|
|
1864
|
+
exports.isSet = isWeakSet$1.isSet;
|
|
1720
1865
|
exports.isUndefined = isWeakSet$1.isUndefined;
|
|
1721
|
-
exports.capitalize =
|
|
1722
|
-
exports.constantCase =
|
|
1723
|
-
exports.deburr =
|
|
1724
|
-
exports.escape =
|
|
1725
|
-
exports.escapeRegExp =
|
|
1726
|
-
exports.lowerFirst =
|
|
1727
|
-
exports.pascalCase =
|
|
1728
|
-
exports.unescape =
|
|
1729
|
-
exports.upperFirst =
|
|
1866
|
+
exports.capitalize = pad$1.capitalize;
|
|
1867
|
+
exports.constantCase = pad$1.constantCase;
|
|
1868
|
+
exports.deburr = pad$1.deburr;
|
|
1869
|
+
exports.escape = pad$1.escape;
|
|
1870
|
+
exports.escapeRegExp = pad$1.escapeRegExp;
|
|
1871
|
+
exports.lowerFirst = pad$1.lowerFirst;
|
|
1872
|
+
exports.pascalCase = pad$1.pascalCase;
|
|
1873
|
+
exports.unescape = pad$1.unescape;
|
|
1874
|
+
exports.upperFirst = pad$1.upperFirst;
|
|
1730
1875
|
exports.ary = ary;
|
|
1731
1876
|
exports.attempt = attempt;
|
|
1732
1877
|
exports.bind = bind;
|
|
@@ -1745,19 +1890,24 @@ exports.debounce = debounce;
|
|
|
1745
1890
|
exports.defer = defer;
|
|
1746
1891
|
exports.difference = difference;
|
|
1747
1892
|
exports.drop = drop;
|
|
1893
|
+
exports.dropWhile = dropWhile;
|
|
1748
1894
|
exports.endsWith = endsWith;
|
|
1895
|
+
exports.every = every;
|
|
1749
1896
|
exports.fill = fill;
|
|
1897
|
+
exports.filter = filter;
|
|
1750
1898
|
exports.find = find;
|
|
1751
1899
|
exports.findIndex = findIndex;
|
|
1752
1900
|
exports.findLastIndex = findLastIndex;
|
|
1753
1901
|
exports.flatten = flatten;
|
|
1754
1902
|
exports.flattenDeep = flattenDeep;
|
|
1755
1903
|
exports.flattenDepth = flattenDepth;
|
|
1904
|
+
exports.flip = flip;
|
|
1756
1905
|
exports.floor = floor;
|
|
1757
1906
|
exports.fromPairs = fromPairs;
|
|
1758
1907
|
exports.get = get;
|
|
1759
1908
|
exports.has = has;
|
|
1760
1909
|
exports.inRange = inRange;
|
|
1910
|
+
exports.includes = includes;
|
|
1761
1911
|
exports.indexOf = indexOf;
|
|
1762
1912
|
exports.isArguments = isArguments;
|
|
1763
1913
|
exports.isArray = isArray;
|
package/dist/compat/index.mjs
CHANGED
|
@@ -5,7 +5,6 @@ export { differenceBy } from '../array/differenceBy.mjs';
|
|
|
5
5
|
export { differenceWith } from '../array/differenceWith.mjs';
|
|
6
6
|
export { dropRight } from '../array/dropRight.mjs';
|
|
7
7
|
export { dropRightWhile } from '../array/dropRightWhile.mjs';
|
|
8
|
-
export { dropWhile } from '../array/dropWhile.mjs';
|
|
9
8
|
export { flatMap } from '../array/flatMap.mjs';
|
|
10
9
|
export { flatMapDeep } from '../array/flatMapDeep.mjs';
|
|
11
10
|
export { forEachRight } from '../array/forEachRight.mjs';
|
|
@@ -57,6 +56,8 @@ export { memoize } from '../function/memoize.mjs';
|
|
|
57
56
|
export { unary } from '../function/unary.mjs';
|
|
58
57
|
export { partial } from '../function/partial.mjs';
|
|
59
58
|
export { partialRight } from '../function/partialRight.mjs';
|
|
59
|
+
export { flow } from '../function/flow.mjs';
|
|
60
|
+
export { flowRight } from '../function/flowRight.mjs';
|
|
60
61
|
export { mean } from '../math/mean.mjs';
|
|
61
62
|
export { meanBy } from '../math/meanBy.mjs';
|
|
62
63
|
export { randomInt } from '../math/randomInt.mjs';
|
|
@@ -73,11 +74,13 @@ export { isObjectLike } from './predicate/isObjectLike.mjs';
|
|
|
73
74
|
export { toMerged } from '../object/toMerged.mjs';
|
|
74
75
|
export { isDate } from '../predicate/isDate.mjs';
|
|
75
76
|
export { isEqual } from '../predicate/isEqual.mjs';
|
|
77
|
+
export { isMap } from '../predicate/isMap.mjs';
|
|
76
78
|
export { isNotNil } from '../predicate/isNotNil.mjs';
|
|
77
79
|
export { isNull } from '../predicate/isNull.mjs';
|
|
78
80
|
export { isUndefined } from '../predicate/isUndefined.mjs';
|
|
79
81
|
export { isLength } from '../predicate/isLength.mjs';
|
|
80
82
|
export { isFunction } from '../predicate/isFunction.mjs';
|
|
83
|
+
export { isSet } from '../predicate/isSet.mjs';
|
|
81
84
|
export { delay } from '../promise/delay.mjs';
|
|
82
85
|
export { withTimeout } from '../promise/withTimeout.mjs';
|
|
83
86
|
export { timeout } from '../promise/timeout.mjs';
|
|
@@ -95,6 +98,8 @@ export { chunk } from './array/chunk.mjs';
|
|
|
95
98
|
export { concat } from './array/concat.mjs';
|
|
96
99
|
export { difference } from './array/difference.mjs';
|
|
97
100
|
export { drop } from './array/drop.mjs';
|
|
101
|
+
export { dropWhile } from './array/dropWhile.mjs';
|
|
102
|
+
export { every } from './array/every.mjs';
|
|
98
103
|
export { fill } from './array/fill.mjs';
|
|
99
104
|
export { find } from './array/find.mjs';
|
|
100
105
|
export { findIndex } from './array/findIndex.mjs';
|
|
@@ -102,6 +107,7 @@ export { findLastIndex } from './array/findLastIndex.mjs';
|
|
|
102
107
|
export { flatten } from './array/flatten.mjs';
|
|
103
108
|
export { flattenDeep } from './array/flattenDeep.mjs';
|
|
104
109
|
export { flattenDepth } from './array/flattenDepth.mjs';
|
|
110
|
+
export { includes } from './array/includes.mjs';
|
|
105
111
|
export { indexOf } from './array/indexOf.mjs';
|
|
106
112
|
export { join } from './array/join.mjs';
|
|
107
113
|
export { orderBy } from './array/orderBy.mjs';
|
|
@@ -109,6 +115,7 @@ export { sortBy } from './array/sortBy.mjs';
|
|
|
109
115
|
export { size } from './array/size.mjs';
|
|
110
116
|
export { some } from './array/some.mjs';
|
|
111
117
|
export { zipObjectDeep } from './array/zipObjectDeep.mjs';
|
|
118
|
+
export { filter } from './array/filter.mjs';
|
|
112
119
|
export { ary } from './function/ary.mjs';
|
|
113
120
|
export { bind } from './function/bind.mjs';
|
|
114
121
|
export { bindKey } from './function/bindKey.mjs';
|
|
@@ -120,6 +127,7 @@ export { rearg } from './function/rearg.mjs';
|
|
|
120
127
|
export { curry } from './function/curry.mjs';
|
|
121
128
|
export { debounce } from './function/debounce.mjs';
|
|
122
129
|
export { throttle } from './function/throttle.mjs';
|
|
130
|
+
export { flip } from './function/flip.mjs';
|
|
123
131
|
export { get } from './object/get.mjs';
|
|
124
132
|
export { set } from './object/set.mjs';
|
|
125
133
|
export { pick } from './object/pick.mjs';
|
|
@@ -1,8 +1,22 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getWords } from '../../string/_internal/getWords.mjs';
|
|
2
2
|
import { normalizeForCase } from '../_internal/normalizeForCase.mjs';
|
|
3
3
|
|
|
4
4
|
function startCase(str) {
|
|
5
|
-
|
|
5
|
+
const words = getWords(normalizeForCase(str).trim());
|
|
6
|
+
let result = '';
|
|
7
|
+
for (let i = 0; i < words.length; i++) {
|
|
8
|
+
const word = words[i];
|
|
9
|
+
if (result) {
|
|
10
|
+
result += ' ';
|
|
11
|
+
}
|
|
12
|
+
if (word === word.toUpperCase()) {
|
|
13
|
+
result += word;
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
result += word[0].toUpperCase() + word.slice(1).toLowerCase();
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return result;
|
|
6
20
|
}
|
|
7
21
|
|
|
8
22
|
export { startCase };
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Converts `value` to an integer.
|
|
3
3
|
*
|
|
4
|
+
* This function first converts `value` to a finite number. If the result has any decimal places,
|
|
5
|
+
* they are removed by rounding down to the nearest whole number.
|
|
6
|
+
*
|
|
4
7
|
* @param {unknown} value - The value to convert.
|
|
5
8
|
* @returns {number} Returns the number.
|
|
6
9
|
*
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Converts `value` to an integer.
|
|
3
3
|
*
|
|
4
|
+
* This function first converts `value` to a finite number. If the result has any decimal places,
|
|
5
|
+
* they are removed by rounding down to the nearest whole number.
|
|
6
|
+
*
|
|
4
7
|
* @param {unknown} value - The value to convert.
|
|
5
8
|
* @returns {number} Returns the number.
|
|
6
9
|
*
|