es-toolkit 1.35.0-dev.1171 → 1.35.0
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/{zip-vor2pd.js → zip-_HttSl.js} +21 -0
- package/dist/array/index.js +3 -22
- package/dist/browser.global.js +1 -1
- package/dist/browser.global.js.map +1 -1
- package/dist/compat/index.d.mts +2 -2
- package/dist/compat/index.d.ts +2 -2
- package/dist/compat/index.js +76 -145
- package/dist/compat/index.mjs +2 -2
- package/dist/compat/object/toPairs.mjs +2 -7
- package/dist/compat/object/toPairsIn.mjs +2 -7
- package/dist/index.js +30 -30
- package/dist/predicate/index.js +27 -27
- package/package.json +1 -1
- package/dist/compat/_internal/mapToEntries.mjs +0 -11
- package/dist/compat/_internal/setToEntries.mjs +0 -11
- 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/partition.d.mts +0 -121
- package/dist/compat/array/partition.d.ts +0 -121
- package/dist/compat/array/partition.mjs +0 -40
- package/dist/_chunk/{isWeakSet-caD_fm.js → isPromise-ByAybB.js} +49 -49
package/dist/compat/index.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { countBy } from '../array/countBy.mjs';
|
|
2
|
+
export { flatMap } from '../array/flatMap.mjs';
|
|
2
3
|
export { flatMapDeep } from '../array/flatMapDeep.mjs';
|
|
3
4
|
export { forEachRight } from '../array/forEachRight.mjs';
|
|
4
5
|
export { groupBy } from '../array/groupBy.mjs';
|
|
@@ -6,6 +7,7 @@ export { initial } from '../array/initial.mjs';
|
|
|
6
7
|
export { isSubset } from '../array/isSubset.mjs';
|
|
7
8
|
export { isSubsetWith } from '../array/isSubsetWith.mjs';
|
|
8
9
|
export { keyBy } from '../array/keyBy.mjs';
|
|
10
|
+
export { partition } from '../array/partition.mjs';
|
|
9
11
|
export { pullAt } from '../array/pullAt.mjs';
|
|
10
12
|
export { sampleSize } from '../array/sampleSize.mjs';
|
|
11
13
|
export { shuffle } from '../array/shuffle.mjs';
|
|
@@ -79,7 +81,6 @@ export { find } from './array/find.mjs';
|
|
|
79
81
|
export { findIndex } from './array/findIndex.mjs';
|
|
80
82
|
export { findLast } from './array/findLast.mjs';
|
|
81
83
|
export { findLastIndex } from './array/findLastIndex.mjs';
|
|
82
|
-
export { flatMap } from './array/flatMap.mjs';
|
|
83
84
|
export { flatten } from './array/flatten.mjs';
|
|
84
85
|
export { flattenDeep } from './array/flattenDeep.mjs';
|
|
85
86
|
export { flattenDepth } from './array/flattenDepth.mjs';
|
|
@@ -96,7 +97,6 @@ export { lastIndexOf } from './array/lastIndexOf.mjs';
|
|
|
96
97
|
export { map } from './array/map.mjs';
|
|
97
98
|
export { nth } from './array/nth.mjs';
|
|
98
99
|
export { orderBy } from './array/orderBy.mjs';
|
|
99
|
-
export { partition } from './array/partition.mjs';
|
|
100
100
|
export { pull } from './array/pull.mjs';
|
|
101
101
|
export { pullAll } from './array/pullAll.mjs';
|
|
102
102
|
export { pullAllBy } from './array/pullAllBy.mjs';
|
package/dist/compat/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { countBy } from '../array/countBy.js';
|
|
2
|
+
export { flatMap } from '../array/flatMap.js';
|
|
2
3
|
export { flatMapDeep } from '../array/flatMapDeep.js';
|
|
3
4
|
export { forEachRight } from '../array/forEachRight.js';
|
|
4
5
|
export { groupBy } from '../array/groupBy.js';
|
|
@@ -6,6 +7,7 @@ export { initial } from '../array/initial.js';
|
|
|
6
7
|
export { isSubset } from '../array/isSubset.js';
|
|
7
8
|
export { isSubsetWith } from '../array/isSubsetWith.js';
|
|
8
9
|
export { keyBy } from '../array/keyBy.js';
|
|
10
|
+
export { partition } from '../array/partition.js';
|
|
9
11
|
export { pullAt } from '../array/pullAt.js';
|
|
10
12
|
export { sampleSize } from '../array/sampleSize.js';
|
|
11
13
|
export { shuffle } from '../array/shuffle.js';
|
|
@@ -79,7 +81,6 @@ export { find } from './array/find.js';
|
|
|
79
81
|
export { findIndex } from './array/findIndex.js';
|
|
80
82
|
export { findLast } from './array/findLast.js';
|
|
81
83
|
export { findLastIndex } from './array/findLastIndex.js';
|
|
82
|
-
export { flatMap } from './array/flatMap.js';
|
|
83
84
|
export { flatten } from './array/flatten.js';
|
|
84
85
|
export { flattenDeep } from './array/flattenDeep.js';
|
|
85
86
|
export { flattenDepth } from './array/flattenDepth.js';
|
|
@@ -96,7 +97,6 @@ export { lastIndexOf } from './array/lastIndexOf.js';
|
|
|
96
97
|
export { map } from './array/map.js';
|
|
97
98
|
export { nth } from './array/nth.js';
|
|
98
99
|
export { orderBy } from './array/orderBy.js';
|
|
99
|
-
export { partition } from './array/partition.js';
|
|
100
100
|
export { pull } from './array/pull.js';
|
|
101
101
|
export { pullAll } from './array/pullAll.js';
|
|
102
102
|
export { pullAllBy } from './array/pullAllBy.js';
|
package/dist/compat/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
const zip$1 = require('../_chunk/zip-
|
|
5
|
+
const zip$1 = require('../_chunk/zip-_HttSl.js');
|
|
6
6
|
const AbortError = require('../_chunk/AbortError-Cg4ZQ1.js');
|
|
7
7
|
const error_index = require('../error/index.js');
|
|
8
8
|
const unary = require('../_chunk/unary-BsNWRM.js');
|
|
@@ -12,7 +12,7 @@ const range$1 = require('../_chunk/range-HnEIT7.js');
|
|
|
12
12
|
const randomInt = require('../_chunk/randomInt-CF7bZK.js');
|
|
13
13
|
const toSnakeCaseKeys = require('../_chunk/toSnakeCaseKeys-BNpS71.js');
|
|
14
14
|
const isPlainObject = require('../_chunk/isPlainObject-Xaozpc.js');
|
|
15
|
-
const
|
|
15
|
+
const isPromise = require('../_chunk/isPromise-ByAybB.js');
|
|
16
16
|
const promise_index = require('../promise/index.js');
|
|
17
17
|
const snakeCase$1 = require('../_chunk/snakeCase-BtVEeB.js');
|
|
18
18
|
const reverseString = require('../_chunk/reverseString-D-wK2p.js');
|
|
@@ -30,7 +30,7 @@ function toArray$1(value) {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
function isArrayLike(value) {
|
|
33
|
-
return value != null && typeof value !== 'function' &&
|
|
33
|
+
return value != null && typeof value !== 'function' && isPromise.isLength(value.length);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
function chunk(arr, size = 1) {
|
|
@@ -301,7 +301,7 @@ function isMatch(target, source) {
|
|
|
301
301
|
}
|
|
302
302
|
default: {
|
|
303
303
|
if (!isObject(target)) {
|
|
304
|
-
return
|
|
304
|
+
return isPromise.eq(target, source);
|
|
305
305
|
}
|
|
306
306
|
return !source;
|
|
307
307
|
}
|
|
@@ -621,7 +621,7 @@ function isIterateeCall(value, index, object) {
|
|
|
621
621
|
}
|
|
622
622
|
if ((typeof index === 'number' && isArrayLike(object) && isIndex(index) && index < object.length) ||
|
|
623
623
|
(typeof index === 'string' && index in object)) {
|
|
624
|
-
return
|
|
624
|
+
return isPromise.eq(object[index], value);
|
|
625
625
|
}
|
|
626
626
|
return false;
|
|
627
627
|
}
|
|
@@ -861,29 +861,6 @@ function flatten(value, depth = 1) {
|
|
|
861
861
|
return result;
|
|
862
862
|
}
|
|
863
863
|
|
|
864
|
-
function map(collection, _iteratee) {
|
|
865
|
-
if (!collection) {
|
|
866
|
-
return [];
|
|
867
|
-
}
|
|
868
|
-
const keys = isArrayLike(collection) || Array.isArray(collection) ? range$1.range(0, collection.length) : Object.keys(collection);
|
|
869
|
-
const iteratee$1 = iteratee(_iteratee ?? unary.identity);
|
|
870
|
-
const result = new Array(keys.length);
|
|
871
|
-
for (let i = 0; i < keys.length; i++) {
|
|
872
|
-
const key = keys[i];
|
|
873
|
-
const value = collection[key];
|
|
874
|
-
result[i] = iteratee$1(value, key, collection);
|
|
875
|
-
}
|
|
876
|
-
return result;
|
|
877
|
-
}
|
|
878
|
-
|
|
879
|
-
function flatMap(collection, iteratee) {
|
|
880
|
-
if (isWeakSet$1.isNil(collection)) {
|
|
881
|
-
return [];
|
|
882
|
-
}
|
|
883
|
-
const mapped = isWeakSet$1.isNil(iteratee) ? map(collection) : map(collection, iteratee);
|
|
884
|
-
return flatten(mapped, 1);
|
|
885
|
-
}
|
|
886
|
-
|
|
887
864
|
function flattenDeep(value) {
|
|
888
865
|
return flatten(value, Infinity);
|
|
889
866
|
}
|
|
@@ -943,7 +920,7 @@ function includes(source, target, fromIndex, guard) {
|
|
|
943
920
|
}
|
|
944
921
|
for (let i = fromIndex; i < keys.length; i++) {
|
|
945
922
|
const value = Reflect.get(source, keys[i]);
|
|
946
|
-
if (
|
|
923
|
+
if (isPromise.eq(value, target)) {
|
|
947
924
|
return true;
|
|
948
925
|
}
|
|
949
926
|
}
|
|
@@ -1027,7 +1004,7 @@ function intersectionWith(firstArr, ...otherArrs) {
|
|
|
1027
1004
|
return [];
|
|
1028
1005
|
}
|
|
1029
1006
|
const _comparator = last(otherArrs);
|
|
1030
|
-
let comparator =
|
|
1007
|
+
let comparator = isPromise.eq;
|
|
1031
1008
|
let uniq$1 = uniq;
|
|
1032
1009
|
if (typeof _comparator === 'function') {
|
|
1033
1010
|
comparator = _comparator;
|
|
@@ -1084,6 +1061,21 @@ function lastIndexOf(array, searchElement, fromIndex) {
|
|
|
1084
1061
|
return Array.from(array).lastIndexOf(searchElement, index);
|
|
1085
1062
|
}
|
|
1086
1063
|
|
|
1064
|
+
function map(collection, _iteratee) {
|
|
1065
|
+
if (!collection) {
|
|
1066
|
+
return [];
|
|
1067
|
+
}
|
|
1068
|
+
const keys = isArrayLike(collection) || Array.isArray(collection) ? range$1.range(0, collection.length) : Object.keys(collection);
|
|
1069
|
+
const iteratee$1 = iteratee(_iteratee ?? unary.identity);
|
|
1070
|
+
const result = new Array(keys.length);
|
|
1071
|
+
for (let i = 0; i < keys.length; i++) {
|
|
1072
|
+
const key = keys[i];
|
|
1073
|
+
const value = collection[key];
|
|
1074
|
+
result[i] = iteratee$1(value, key, collection);
|
|
1075
|
+
}
|
|
1076
|
+
return result;
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1087
1079
|
function nth(array, n = 0) {
|
|
1088
1080
|
if (!isArrayLikeObject(array) || array.length === 0) {
|
|
1089
1081
|
return undefined;
|
|
@@ -1216,41 +1208,6 @@ function orderBy(collection, criteria, orders, guard) {
|
|
|
1216
1208
|
.map(item => item.original);
|
|
1217
1209
|
}
|
|
1218
1210
|
|
|
1219
|
-
function partition(source, predicate) {
|
|
1220
|
-
if (!source) {
|
|
1221
|
-
return [[], []];
|
|
1222
|
-
}
|
|
1223
|
-
const collection = toSnakeCaseKeys.isArray(source) ? source : Object.values(source);
|
|
1224
|
-
predicate = iteratee(predicate);
|
|
1225
|
-
const matched = [];
|
|
1226
|
-
const unmatched = [];
|
|
1227
|
-
if (!toSnakeCaseKeys.isArray(source)) {
|
|
1228
|
-
const keys = Object.keys(source);
|
|
1229
|
-
const length = isArrayLike(source) ? source.length : keys.length;
|
|
1230
|
-
for (let i = 0; i < length; i++) {
|
|
1231
|
-
const key = keys[i];
|
|
1232
|
-
const value = source[key];
|
|
1233
|
-
if (predicate(value, key, source)) {
|
|
1234
|
-
matched.push(value);
|
|
1235
|
-
}
|
|
1236
|
-
else {
|
|
1237
|
-
unmatched.push(value);
|
|
1238
|
-
}
|
|
1239
|
-
}
|
|
1240
|
-
return [matched, unmatched];
|
|
1241
|
-
}
|
|
1242
|
-
for (let i = 0; i < collection.length; i++) {
|
|
1243
|
-
const value = collection[i];
|
|
1244
|
-
if (predicate(value, i, source)) {
|
|
1245
|
-
matched.push(value);
|
|
1246
|
-
}
|
|
1247
|
-
else {
|
|
1248
|
-
unmatched.push(value);
|
|
1249
|
-
}
|
|
1250
|
-
}
|
|
1251
|
-
return [matched, unmatched];
|
|
1252
|
-
}
|
|
1253
|
-
|
|
1254
1211
|
function pull(arr, ...valuesToRemove) {
|
|
1255
1212
|
return zip$1.pull(arr, valuesToRemove);
|
|
1256
1213
|
}
|
|
@@ -1375,7 +1332,7 @@ function sample(collection) {
|
|
|
1375
1332
|
}
|
|
1376
1333
|
|
|
1377
1334
|
function size(target) {
|
|
1378
|
-
if (
|
|
1335
|
+
if (isPromise.isNil(target)) {
|
|
1379
1336
|
return 0;
|
|
1380
1337
|
}
|
|
1381
1338
|
if (target instanceof Map || target instanceof Set) {
|
|
@@ -1492,15 +1449,15 @@ function sortedIndexBy(array, value, iteratee$1, retHighest) {
|
|
|
1492
1449
|
const iterateeFunction = iteratee(iteratee$1);
|
|
1493
1450
|
const transformedValue = iterateeFunction(value);
|
|
1494
1451
|
const valIsNaN = isNaN(transformedValue);
|
|
1495
|
-
const valIsNull =
|
|
1452
|
+
const valIsNull = isPromise.isNull(transformedValue);
|
|
1496
1453
|
const valIsSymbol = isSymbol(transformedValue);
|
|
1497
|
-
const valIsUndefined =
|
|
1454
|
+
const valIsUndefined = isPromise.isUndefined(transformedValue);
|
|
1498
1455
|
while (low < high) {
|
|
1499
1456
|
let setLow;
|
|
1500
1457
|
const mid = Math.floor((low + high) / 2);
|
|
1501
1458
|
const computed = iterateeFunction(array[mid]);
|
|
1502
|
-
const othIsDefined = !
|
|
1503
|
-
const othIsNull =
|
|
1459
|
+
const othIsDefined = !isPromise.isUndefined(computed);
|
|
1460
|
+
const othIsNull = isPromise.isNull(computed);
|
|
1504
1461
|
const othIsReflexive = !isNaN(computed);
|
|
1505
1462
|
const othIsSymbol = isSymbol(computed);
|
|
1506
1463
|
if (valIsNaN) {
|
|
@@ -1538,15 +1495,15 @@ function isNumber(value) {
|
|
|
1538
1495
|
const MAX_ARRAY_LENGTH$2 = 4294967295;
|
|
1539
1496
|
const HALF_MAX_ARRAY_LENGTH$1 = MAX_ARRAY_LENGTH$2 >>> 1;
|
|
1540
1497
|
function sortedIndex(array, value) {
|
|
1541
|
-
if (
|
|
1498
|
+
if (isPromise.isNil(array)) {
|
|
1542
1499
|
return 0;
|
|
1543
1500
|
}
|
|
1544
|
-
let low = 0, high =
|
|
1501
|
+
let low = 0, high = isPromise.isNil(array) ? low : array.length;
|
|
1545
1502
|
if (isNumber(value) && value === value && high <= HALF_MAX_ARRAY_LENGTH$1) {
|
|
1546
1503
|
while (low < high) {
|
|
1547
1504
|
const mid = (low + high) >>> 1;
|
|
1548
1505
|
const compute = array[mid];
|
|
1549
|
-
if (!
|
|
1506
|
+
if (!isPromise.isNull(compute) && !isPromise.isSymbol(compute) && compute < value) {
|
|
1550
1507
|
low = mid + 1;
|
|
1551
1508
|
}
|
|
1552
1509
|
else {
|
|
@@ -1563,7 +1520,7 @@ function sortedIndexOf(array, value) {
|
|
|
1563
1520
|
return -1;
|
|
1564
1521
|
}
|
|
1565
1522
|
const index = sortedIndex(array, value);
|
|
1566
|
-
if (index < array.length &&
|
|
1523
|
+
if (index < array.length && isPromise.eq(array[index], value)) {
|
|
1567
1524
|
return index;
|
|
1568
1525
|
}
|
|
1569
1526
|
return -1;
|
|
@@ -1576,7 +1533,7 @@ function sortedLastIndexBy(array, value, iteratee) {
|
|
|
1576
1533
|
const MAX_ARRAY_LENGTH$1 = 4294967295;
|
|
1577
1534
|
const HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH$1 >>> 1;
|
|
1578
1535
|
function sortedLastIndex(array, value) {
|
|
1579
|
-
if (
|
|
1536
|
+
if (isPromise.isNil(array)) {
|
|
1580
1537
|
return 0;
|
|
1581
1538
|
}
|
|
1582
1539
|
let high = array.length;
|
|
@@ -1587,7 +1544,7 @@ function sortedLastIndex(array, value) {
|
|
|
1587
1544
|
while (low < high) {
|
|
1588
1545
|
const mid = (low + high) >>> 1;
|
|
1589
1546
|
const compute = array[mid];
|
|
1590
|
-
if (!
|
|
1547
|
+
if (!isPromise.isNull(compute) && !isPromise.isSymbol(compute) && compute <= value) {
|
|
1591
1548
|
low = mid + 1;
|
|
1592
1549
|
}
|
|
1593
1550
|
else {
|
|
@@ -1701,7 +1658,7 @@ function zip(...arrays) {
|
|
|
1701
1658
|
|
|
1702
1659
|
const assignValue = (object, key, value) => {
|
|
1703
1660
|
const objValue = object[key];
|
|
1704
|
-
if (!(Object.hasOwn(object, key) &&
|
|
1661
|
+
if (!(Object.hasOwn(object, key) && isPromise.eq(objValue, value)) || (value === undefined && !(key in object))) {
|
|
1705
1662
|
object[key] = value;
|
|
1706
1663
|
}
|
|
1707
1664
|
};
|
|
@@ -1774,7 +1731,7 @@ function zipObjectDeep(keys, values) {
|
|
|
1774
1731
|
|
|
1775
1732
|
function zipWith(...combine) {
|
|
1776
1733
|
let iteratee = combine.pop();
|
|
1777
|
-
if (!
|
|
1734
|
+
if (!isPromise.isFunction(iteratee)) {
|
|
1778
1735
|
combine.push(iteratee);
|
|
1779
1736
|
iteratee = undefined;
|
|
1780
1737
|
}
|
|
@@ -2350,7 +2307,7 @@ function keys(object) {
|
|
|
2350
2307
|
function arrayLikeKeys(object) {
|
|
2351
2308
|
const indices = times(object.length, index => `${index}`);
|
|
2352
2309
|
const filteredKeys = new Set(indices);
|
|
2353
|
-
if (
|
|
2310
|
+
if (isPromise.isBuffer(object)) {
|
|
2354
2311
|
filteredKeys.add('offset');
|
|
2355
2312
|
filteredKeys.add('parent');
|
|
2356
2313
|
}
|
|
@@ -2372,7 +2329,7 @@ function assignImpl(object, source) {
|
|
|
2372
2329
|
const keys$1 = keys(source);
|
|
2373
2330
|
for (let i = 0; i < keys$1.length; i++) {
|
|
2374
2331
|
const key = keys$1[i];
|
|
2375
|
-
if (!(key in object) || !
|
|
2332
|
+
if (!(key in object) || !isPromise.eq(object[key], source[key])) {
|
|
2376
2333
|
object[key] = source[key];
|
|
2377
2334
|
}
|
|
2378
2335
|
}
|
|
@@ -2412,7 +2369,7 @@ function prototypeKeysIn(object) {
|
|
|
2412
2369
|
function arrayLikeKeysIn(object) {
|
|
2413
2370
|
const indices = times(object.length, index => `${index}`);
|
|
2414
2371
|
const filteredKeys = new Set(indices);
|
|
2415
|
-
if (
|
|
2372
|
+
if (isPromise.isBuffer(object)) {
|
|
2416
2373
|
filteredKeys.add('offset');
|
|
2417
2374
|
filteredKeys.add('parent');
|
|
2418
2375
|
}
|
|
@@ -2434,7 +2391,7 @@ function assignInImpl(object, source) {
|
|
|
2434
2391
|
const keys = keysIn(source);
|
|
2435
2392
|
for (let i = 0; i < keys.length; i++) {
|
|
2436
2393
|
const key = keys[i];
|
|
2437
|
-
if (!(key in object) || !
|
|
2394
|
+
if (!(key in object) || !isPromise.eq(object[key], source[key])) {
|
|
2438
2395
|
object[key] = source[key];
|
|
2439
2396
|
}
|
|
2440
2397
|
}
|
|
@@ -2460,7 +2417,7 @@ function assignInWithImpl(object, source, getValueToAssign) {
|
|
|
2460
2417
|
const objValue = object[key];
|
|
2461
2418
|
const srcValue = source[key];
|
|
2462
2419
|
const newValue = getValueToAssign?.(objValue, srcValue, key, object, source) ?? srcValue;
|
|
2463
|
-
if (!(key in object) || !
|
|
2420
|
+
if (!(key in object) || !isPromise.eq(objValue, newValue)) {
|
|
2464
2421
|
object[key] = newValue;
|
|
2465
2422
|
}
|
|
2466
2423
|
}
|
|
@@ -2486,7 +2443,7 @@ function assignWithImpl(object, source, getValueToAssign) {
|
|
|
2486
2443
|
const objValue = object[key];
|
|
2487
2444
|
const srcValue = source[key];
|
|
2488
2445
|
const newValue = getValueToAssign?.(objValue, srcValue, key, object, source) ?? srcValue;
|
|
2489
|
-
if (!(key in object) || !
|
|
2446
|
+
if (!(key in object) || !isPromise.eq(objValue, newValue)) {
|
|
2490
2447
|
object[key] = newValue;
|
|
2491
2448
|
}
|
|
2492
2449
|
}
|
|
@@ -2537,7 +2494,7 @@ function defaults(object, ...sources) {
|
|
|
2537
2494
|
const key = keys[j];
|
|
2538
2495
|
const value = object[key];
|
|
2539
2496
|
if (value === undefined ||
|
|
2540
|
-
(!Object.hasOwn(object, key) &&
|
|
2497
|
+
(!Object.hasOwn(object, key) && isPromise.eq(value, objectProto[key]))) {
|
|
2541
2498
|
object[key] = source[key];
|
|
2542
2499
|
}
|
|
2543
2500
|
}
|
|
@@ -2592,7 +2549,7 @@ function functionsIn(object) {
|
|
|
2592
2549
|
}
|
|
2593
2550
|
const result = [];
|
|
2594
2551
|
for (const key in object) {
|
|
2595
|
-
if (
|
|
2552
|
+
if (isPromise.isFunction(object[key])) {
|
|
2596
2553
|
result.push(key);
|
|
2597
2554
|
}
|
|
2598
2555
|
}
|
|
@@ -2601,7 +2558,7 @@ function functionsIn(object) {
|
|
|
2601
2558
|
|
|
2602
2559
|
function invertBy(object, iteratee) {
|
|
2603
2560
|
const result = {};
|
|
2604
|
-
if (
|
|
2561
|
+
if (isPromise.isNil(object)) {
|
|
2605
2562
|
return result;
|
|
2606
2563
|
}
|
|
2607
2564
|
if (iteratee == null) {
|
|
@@ -2906,32 +2863,9 @@ function toDefaulted(object, ...sources) {
|
|
|
2906
2863
|
return defaults(cloned, ...sources);
|
|
2907
2864
|
}
|
|
2908
2865
|
|
|
2909
|
-
function mapToEntries(map) {
|
|
2910
|
-
const arr = new Array(map.size);
|
|
2911
|
-
const keys = map.keys();
|
|
2912
|
-
const values = map.values();
|
|
2913
|
-
for (let i = 0; i < arr.length; i++) {
|
|
2914
|
-
arr[i] = [keys.next().value, values.next().value];
|
|
2915
|
-
}
|
|
2916
|
-
return arr;
|
|
2917
|
-
}
|
|
2918
|
-
|
|
2919
|
-
function setToEntries(set) {
|
|
2920
|
-
const arr = new Array(set.size);
|
|
2921
|
-
const values = set.values();
|
|
2922
|
-
for (let i = 0; i < arr.length; i++) {
|
|
2923
|
-
const value = values.next().value;
|
|
2924
|
-
arr[i] = [value, value];
|
|
2925
|
-
}
|
|
2926
|
-
return arr;
|
|
2927
|
-
}
|
|
2928
|
-
|
|
2929
2866
|
function toPairs(object) {
|
|
2930
|
-
if (object instanceof Set) {
|
|
2931
|
-
return
|
|
2932
|
-
}
|
|
2933
|
-
if (object instanceof Map) {
|
|
2934
|
-
return mapToEntries(object);
|
|
2867
|
+
if (object instanceof Set || object instanceof Map) {
|
|
2868
|
+
return Array.from(object.entries());
|
|
2935
2869
|
}
|
|
2936
2870
|
const keys$1 = keys(object);
|
|
2937
2871
|
const result = new Array(keys$1.length);
|
|
@@ -2944,11 +2878,8 @@ function toPairs(object) {
|
|
|
2944
2878
|
}
|
|
2945
2879
|
|
|
2946
2880
|
function toPairsIn(object) {
|
|
2947
|
-
if (object instanceof Set) {
|
|
2948
|
-
return
|
|
2949
|
-
}
|
|
2950
|
-
if (object instanceof Map) {
|
|
2951
|
-
return mapToEntries(object);
|
|
2881
|
+
if (object instanceof Set || object instanceof Map) {
|
|
2882
|
+
return Array.from(object.entries());
|
|
2952
2883
|
}
|
|
2953
2884
|
const keys = keysIn(object);
|
|
2954
2885
|
const result = new Array(keys.length);
|
|
@@ -3005,7 +2936,7 @@ function conforms(source) {
|
|
|
3005
2936
|
}
|
|
3006
2937
|
|
|
3007
2938
|
function isArrayBuffer(value) {
|
|
3008
|
-
return
|
|
2939
|
+
return isPromise.isArrayBuffer(value);
|
|
3009
2940
|
}
|
|
3010
2941
|
|
|
3011
2942
|
function isBoolean(value) {
|
|
@@ -3013,11 +2944,11 @@ function isBoolean(value) {
|
|
|
3013
2944
|
}
|
|
3014
2945
|
|
|
3015
2946
|
function isBuffer(x) {
|
|
3016
|
-
return
|
|
2947
|
+
return isPromise.isBuffer(x);
|
|
3017
2948
|
}
|
|
3018
2949
|
|
|
3019
2950
|
function isDate(value) {
|
|
3020
|
-
return
|
|
2951
|
+
return isPromise.isDate(value);
|
|
3021
2952
|
}
|
|
3022
2953
|
|
|
3023
2954
|
function isElement(value) {
|
|
@@ -3055,7 +2986,7 @@ function isEqualWith(a, b, areValuesEqual = noop.noop) {
|
|
|
3055
2986
|
if (typeof areValuesEqual !== 'function') {
|
|
3056
2987
|
areValuesEqual = noop.noop;
|
|
3057
2988
|
}
|
|
3058
|
-
return
|
|
2989
|
+
return isPromise.isEqualWith(a, b, (...args) => {
|
|
3059
2990
|
const result = areValuesEqual(...args);
|
|
3060
2991
|
if (result !== undefined) {
|
|
3061
2992
|
return Boolean(result);
|
|
@@ -3082,11 +3013,11 @@ function isInteger(value) {
|
|
|
3082
3013
|
}
|
|
3083
3014
|
|
|
3084
3015
|
function isMap(value) {
|
|
3085
|
-
return
|
|
3016
|
+
return isPromise.isMap(value);
|
|
3086
3017
|
}
|
|
3087
3018
|
|
|
3088
3019
|
function isRegExp(value) {
|
|
3089
|
-
return
|
|
3020
|
+
return isPromise.isRegExp(value);
|
|
3090
3021
|
}
|
|
3091
3022
|
|
|
3092
3023
|
function isSafeInteger(value) {
|
|
@@ -3094,15 +3025,15 @@ function isSafeInteger(value) {
|
|
|
3094
3025
|
}
|
|
3095
3026
|
|
|
3096
3027
|
function isSet(value) {
|
|
3097
|
-
return
|
|
3028
|
+
return isPromise.isSet(value);
|
|
3098
3029
|
}
|
|
3099
3030
|
|
|
3100
3031
|
function isWeakMap(value) {
|
|
3101
|
-
return
|
|
3032
|
+
return isPromise.isWeakMap(value);
|
|
3102
3033
|
}
|
|
3103
3034
|
|
|
3104
3035
|
function isWeakSet(value) {
|
|
3105
|
-
return
|
|
3036
|
+
return isPromise.isWeakSet(value);
|
|
3106
3037
|
}
|
|
3107
3038
|
|
|
3108
3039
|
function normalizeForCase(str) {
|
|
@@ -3374,7 +3305,7 @@ function cond(pairs) {
|
|
|
3374
3305
|
const processedPairs = pairs.map(pair => {
|
|
3375
3306
|
const predicate = pair[0];
|
|
3376
3307
|
const func = pair[1];
|
|
3377
|
-
if (!
|
|
3308
|
+
if (!isPromise.isFunction(func)) {
|
|
3378
3309
|
throw new TypeError('Expected a function');
|
|
3379
3310
|
}
|
|
3380
3311
|
return [iteratee(predicate), func];
|
|
@@ -3578,6 +3509,7 @@ function uniqueId(prefix = '') {
|
|
|
3578
3509
|
}
|
|
3579
3510
|
|
|
3580
3511
|
exports.countBy = zip$1.countBy;
|
|
3512
|
+
exports.flatMap = zip$1.flatMap;
|
|
3581
3513
|
exports.flatMapDeep = zip$1.flatMapDeep;
|
|
3582
3514
|
exports.forEachRight = zip$1.forEachRight;
|
|
3583
3515
|
exports.groupBy = zip$1.groupBy;
|
|
@@ -3585,6 +3517,7 @@ exports.initial = zip$1.initial;
|
|
|
3585
3517
|
exports.isSubset = zip$1.isSubset;
|
|
3586
3518
|
exports.isSubsetWith = zip$1.isSubsetWith;
|
|
3587
3519
|
exports.keyBy = zip$1.keyBy;
|
|
3520
|
+
exports.partition = zip$1.partition;
|
|
3588
3521
|
exports.pullAt = zip$1.pullAt;
|
|
3589
3522
|
exports.sampleSize = zip$1.sampleSize;
|
|
3590
3523
|
exports.shuffle = zip$1.shuffle;
|
|
@@ -3623,22 +3556,22 @@ exports.toCamelCaseKeys = toSnakeCaseKeys.toCamelCaseKeys;
|
|
|
3623
3556
|
exports.toMerged = toSnakeCaseKeys.toMerged;
|
|
3624
3557
|
exports.toSnakeCaseKeys = toSnakeCaseKeys.toSnakeCaseKeys;
|
|
3625
3558
|
exports.isPrimitive = isPlainObject.isPrimitive;
|
|
3626
|
-
exports.eq =
|
|
3627
|
-
exports.isBlob =
|
|
3628
|
-
exports.isBrowser =
|
|
3629
|
-
exports.isEqual =
|
|
3630
|
-
exports.isFile =
|
|
3631
|
-
exports.isFunction =
|
|
3632
|
-
exports.isJSON =
|
|
3633
|
-
exports.isJSONArray =
|
|
3634
|
-
exports.isJSONObject =
|
|
3635
|
-
exports.isJSONValue =
|
|
3636
|
-
exports.isLength =
|
|
3637
|
-
exports.isNode =
|
|
3638
|
-
exports.isNotNil =
|
|
3639
|
-
exports.isNull =
|
|
3640
|
-
exports.isPromise =
|
|
3641
|
-
exports.isUndefined =
|
|
3559
|
+
exports.eq = isPromise.eq;
|
|
3560
|
+
exports.isBlob = isPromise.isBlob;
|
|
3561
|
+
exports.isBrowser = isPromise.isBrowser;
|
|
3562
|
+
exports.isEqual = isPromise.isEqual;
|
|
3563
|
+
exports.isFile = isPromise.isFile;
|
|
3564
|
+
exports.isFunction = isPromise.isFunction;
|
|
3565
|
+
exports.isJSON = isPromise.isJSON;
|
|
3566
|
+
exports.isJSONArray = isPromise.isJSONArray;
|
|
3567
|
+
exports.isJSONObject = isPromise.isJSONObject;
|
|
3568
|
+
exports.isJSONValue = isPromise.isJSONValue;
|
|
3569
|
+
exports.isLength = isPromise.isLength;
|
|
3570
|
+
exports.isNode = isPromise.isNode;
|
|
3571
|
+
exports.isNotNil = isPromise.isNotNil;
|
|
3572
|
+
exports.isNull = isPromise.isNull;
|
|
3573
|
+
exports.isPromise = isPromise.isPromise;
|
|
3574
|
+
exports.isUndefined = isPromise.isUndefined;
|
|
3642
3575
|
exports.Mutex = promise_index.Mutex;
|
|
3643
3576
|
exports.Semaphore = promise_index.Semaphore;
|
|
3644
3577
|
exports.timeout = promise_index.timeout;
|
|
@@ -3702,7 +3635,6 @@ exports.findKey = findKey;
|
|
|
3702
3635
|
exports.findLast = findLast;
|
|
3703
3636
|
exports.findLastIndex = findLastIndex;
|
|
3704
3637
|
exports.first = head;
|
|
3705
|
-
exports.flatMap = flatMap;
|
|
3706
3638
|
exports.flatten = flatten;
|
|
3707
3639
|
exports.flattenDeep = flattenDeep;
|
|
3708
3640
|
exports.flattenDepth = flattenDepth;
|
|
@@ -3792,7 +3724,6 @@ exports.pad = pad;
|
|
|
3792
3724
|
exports.padEnd = padEnd;
|
|
3793
3725
|
exports.padStart = padStart;
|
|
3794
3726
|
exports.parseInt = parseInt;
|
|
3795
|
-
exports.partition = partition;
|
|
3796
3727
|
exports.pick = pick;
|
|
3797
3728
|
exports.pickBy = pickBy;
|
|
3798
3729
|
exports.property = property;
|
package/dist/compat/index.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { countBy } from '../array/countBy.mjs';
|
|
2
|
+
export { flatMap } from '../array/flatMap.mjs';
|
|
2
3
|
export { flatMapDeep } from '../array/flatMapDeep.mjs';
|
|
3
4
|
export { forEachRight } from '../array/forEachRight.mjs';
|
|
4
5
|
export { groupBy } from '../array/groupBy.mjs';
|
|
@@ -6,6 +7,7 @@ export { initial } from '../array/initial.mjs';
|
|
|
6
7
|
export { isSubset } from '../array/isSubset.mjs';
|
|
7
8
|
export { isSubsetWith } from '../array/isSubsetWith.mjs';
|
|
8
9
|
export { keyBy } from '../array/keyBy.mjs';
|
|
10
|
+
export { partition } from '../array/partition.mjs';
|
|
9
11
|
export { pullAt } from '../array/pullAt.mjs';
|
|
10
12
|
export { sampleSize } from '../array/sampleSize.mjs';
|
|
11
13
|
export { shuffle } from '../array/shuffle.mjs';
|
|
@@ -81,7 +83,6 @@ export { find } from './array/find.mjs';
|
|
|
81
83
|
export { findIndex } from './array/findIndex.mjs';
|
|
82
84
|
export { findLast } from './array/findLast.mjs';
|
|
83
85
|
export { findLastIndex } from './array/findLastIndex.mjs';
|
|
84
|
-
export { flatMap } from './array/flatMap.mjs';
|
|
85
86
|
export { flatten } from './array/flatten.mjs';
|
|
86
87
|
export { flattenDeep } from './array/flattenDeep.mjs';
|
|
87
88
|
export { flattenDepth } from './array/flattenDepth.mjs';
|
|
@@ -98,7 +99,6 @@ export { lastIndexOf } from './array/lastIndexOf.mjs';
|
|
|
98
99
|
export { map } from './array/map.mjs';
|
|
99
100
|
export { nth } from './array/nth.mjs';
|
|
100
101
|
export { orderBy } from './array/orderBy.mjs';
|
|
101
|
-
export { partition } from './array/partition.mjs';
|
|
102
102
|
export { pull } from './array/pull.mjs';
|
|
103
103
|
export { pullAll } from './array/pullAll.mjs';
|
|
104
104
|
export { pullAllBy } from './array/pullAllBy.mjs';
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import { keys } from './keys.mjs';
|
|
2
|
-
import { mapToEntries } from '../_internal/mapToEntries.mjs';
|
|
3
|
-
import { setToEntries } from '../_internal/setToEntries.mjs';
|
|
4
2
|
|
|
5
3
|
function toPairs(object) {
|
|
6
|
-
if (object instanceof Set) {
|
|
7
|
-
return
|
|
8
|
-
}
|
|
9
|
-
if (object instanceof Map) {
|
|
10
|
-
return mapToEntries(object);
|
|
4
|
+
if (object instanceof Set || object instanceof Map) {
|
|
5
|
+
return Array.from(object.entries());
|
|
11
6
|
}
|
|
12
7
|
const keys$1 = keys(object);
|
|
13
8
|
const result = new Array(keys$1.length);
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import { keysIn } from './keysIn.mjs';
|
|
2
|
-
import { mapToEntries } from '../_internal/mapToEntries.mjs';
|
|
3
|
-
import { setToEntries } from '../_internal/setToEntries.mjs';
|
|
4
2
|
|
|
5
3
|
function toPairsIn(object) {
|
|
6
|
-
if (object instanceof Set) {
|
|
7
|
-
return
|
|
8
|
-
}
|
|
9
|
-
if (object instanceof Map) {
|
|
10
|
-
return mapToEntries(object);
|
|
4
|
+
if (object instanceof Set || object instanceof Map) {
|
|
5
|
+
return Array.from(object.entries());
|
|
11
6
|
}
|
|
12
7
|
const keys = keysIn(object);
|
|
13
8
|
const result = new Array(keys.length);
|