es-toolkit 1.24.0 → 1.25.0-dev.786
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 +12 -0
- package/dist/_chunk/isPlainObject-octpoD.js +32 -0
- package/dist/_chunk/{isWeakSet-Bd6nry.js → isWeakSet-BuFfzX.js} +11 -8
- package/dist/_chunk/{toMerged-DDLv0D.js → toMerged-B5ZVux.js} +3 -6
- package/dist/_chunk/{unary-BZ5Ixo.js → unary-CMvKXy.js} +2 -2
- package/dist/_chunk/{zipWith-wpjySR.js → zipWith-Dkv3D1.js} +7 -1
- package/dist/array/at.mjs +1 -1
- package/dist/array/index.js +2 -7
- package/dist/browser.global.js +1 -1
- package/dist/browser.global.js.map +1 -1
- package/dist/compat/_internal/MAX_SAFE_INTEGER.mjs +3 -0
- package/dist/compat/array/chunk.d.mts +2 -3
- package/dist/compat/array/chunk.d.ts +2 -3
- package/dist/compat/array/chunk.mjs +3 -2
- package/dist/compat/array/compact.d.mts +16 -0
- package/dist/compat/array/compact.d.ts +16 -0
- package/dist/compat/array/compact.mjs +11 -0
- package/dist/compat/array/drop.d.mts +2 -2
- package/dist/compat/array/drop.d.ts +2 -2
- package/dist/compat/array/drop.mjs +5 -3
- package/dist/compat/array/dropRight.d.mts +19 -0
- package/dist/compat/array/dropRight.d.ts +19 -0
- package/dist/compat/array/dropRight.mjs +11 -0
- package/dist/compat/array/dropRightWhile.d.mts +8 -8
- package/dist/compat/array/dropRightWhile.d.ts +8 -8
- package/dist/compat/array/dropRightWhile.mjs +7 -0
- package/dist/compat/array/dropWhile.d.mts +8 -8
- package/dist/compat/array/dropWhile.d.ts +8 -8
- package/dist/compat/array/dropWhile.mjs +7 -0
- package/dist/compat/array/head.d.mts +18 -0
- package/dist/compat/array/head.d.ts +18 -0
- package/dist/compat/array/head.mjs +11 -0
- package/dist/compat/array/intersection.d.mts +20 -0
- package/dist/compat/array/intersection.d.ts +20 -0
- package/dist/compat/array/intersection.mjs +23 -0
- package/dist/compat/array/last.d.mts +25 -0
- package/dist/compat/array/last.d.ts +25 -0
- package/dist/compat/array/last.mjs +11 -0
- package/dist/compat/array/sample.d.mts +80 -0
- package/dist/compat/array/sample.d.ts +80 -0
- package/dist/compat/array/sample.mjs +14 -0
- package/dist/compat/array/tail.d.mts +27 -0
- package/dist/compat/array/tail.d.ts +27 -0
- package/dist/compat/array/tail.mjs +11 -0
- package/dist/compat/array/take.d.mts +3 -3
- package/dist/compat/array/take.d.ts +3 -3
- package/dist/compat/array/take.mjs +4 -3
- package/dist/compat/array/takeRight.d.mts +24 -0
- package/dist/compat/array/takeRight.d.ts +24 -0
- package/dist/compat/array/takeRight.mjs +11 -0
- package/dist/compat/array/uniq.d.mts +18 -0
- package/dist/compat/array/uniq.d.ts +18 -0
- package/dist/compat/array/uniq.mjs +11 -0
- package/dist/compat/array/without.d.mts +23 -0
- package/dist/compat/array/without.d.ts +23 -0
- package/dist/compat/array/without.mjs +11 -0
- package/dist/compat/index.d.mts +13 -11
- package/dist/compat/index.d.ts +13 -11
- package/dist/compat/index.js +143 -30
- package/dist/compat/index.mjs +13 -11
- package/dist/compat/object/pick.mjs +4 -0
- package/dist/compat/string/escape.d.mts +16 -0
- package/dist/compat/string/escape.d.ts +16 -0
- package/dist/compat/string/escape.mjs +8 -0
- package/dist/compat/util/toSafeInteger.d.mts +20 -0
- package/dist/compat/util/toSafeInteger.d.ts +20 -0
- package/dist/compat/util/toSafeInteger.mjs +12 -0
- package/dist/function/after.d.mts +2 -2
- package/dist/function/after.d.ts +2 -2
- package/dist/function/after.mjs +2 -2
- package/dist/function/index.js +1 -1
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +7 -6
- package/dist/index.mjs +1 -0
- package/dist/object/cloneDeep.mjs +3 -5
- 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/isFile.d.mts +21 -0
- package/dist/predicate/isFile.d.ts +21 -0
- package/dist/predicate/isFile.mjs +10 -0
- package/dist/predicate/isPlainObject.d.mts +34 -5
- package/dist/predicate/isPlainObject.d.ts +34 -5
- package/dist/predicate/isPlainObject.mjs +7 -13
- package/package.json +1 -1
- package/dist/_chunk/isPlainObject-DgrsU7.js +0 -33
package/dist/compat/index.d.ts
CHANGED
|
@@ -1,42 +1,32 @@
|
|
|
1
1
|
export { at } from '../array/at.js';
|
|
2
|
-
export { compact } from '../array/compact.js';
|
|
3
2
|
export { countBy } from '../array/countBy.js';
|
|
4
3
|
export { differenceBy } from '../array/differenceBy.js';
|
|
5
4
|
export { differenceWith } from '../array/differenceWith.js';
|
|
6
|
-
export { dropRight } from '../array/dropRight.js';
|
|
7
5
|
export { flatMap } from '../array/flatMap.js';
|
|
8
6
|
export { flatMapDeep } from '../array/flatMapDeep.js';
|
|
9
7
|
export { forEachRight } from '../array/forEachRight.js';
|
|
10
8
|
export { groupBy } from '../array/groupBy.js';
|
|
11
|
-
export { head as first, head } from '../array/head.js';
|
|
12
9
|
export { initial } from '../array/initial.js';
|
|
13
|
-
export { intersection } from '../array/intersection.js';
|
|
14
10
|
export { intersectionBy } from '../array/intersectionBy.js';
|
|
15
11
|
export { intersectionWith } from '../array/intersectionWith.js';
|
|
16
12
|
export { isSubset } from '../array/isSubset.js';
|
|
17
13
|
export { keyBy } from '../array/keyBy.js';
|
|
18
|
-
export { last } from '../array/last.js';
|
|
19
14
|
export { maxBy } from '../array/maxBy.js';
|
|
20
15
|
export { minBy } from '../array/minBy.js';
|
|
21
16
|
export { partition } from '../array/partition.js';
|
|
22
17
|
export { pullAt } from '../array/pullAt.js';
|
|
23
|
-
export { sample } from '../array/sample.js';
|
|
24
18
|
export { sampleSize } from '../array/sampleSize.js';
|
|
25
19
|
export { shuffle } from '../array/shuffle.js';
|
|
26
|
-
export { tail } from '../array/tail.js';
|
|
27
|
-
export { takeRight } from '../array/takeRight.js';
|
|
28
20
|
export { takeRightWhile } from '../array/takeRightWhile.js';
|
|
29
21
|
export { takeWhile } from '../array/takeWhile.js';
|
|
30
22
|
export { toFilled } from '../array/toFilled.js';
|
|
31
23
|
export { union } from '../array/union.js';
|
|
32
24
|
export { unionBy } from '../array/unionBy.js';
|
|
33
25
|
export { unionWith } from '../array/unionWith.js';
|
|
34
|
-
export { uniq } from '../array/uniq.js';
|
|
35
26
|
export { uniqBy } from '../array/uniqBy.js';
|
|
36
27
|
export { uniqWith } from '../array/uniqWith.js';
|
|
37
28
|
export { unzip } from '../array/unzip.js';
|
|
38
29
|
export { unzipWith } from '../array/unzipWith.js';
|
|
39
|
-
export { without } from '../array/without.js';
|
|
40
30
|
export { xor } from '../array/xor.js';
|
|
41
31
|
export { xorBy } from '../array/xorBy.js';
|
|
42
32
|
export { xorWith } from '../array/xorWith.js';
|
|
@@ -68,6 +58,7 @@ export { pickBy } from '../object/pickBy.js';
|
|
|
68
58
|
export { toMerged } from '../object/toMerged.js';
|
|
69
59
|
export { isBlob } from '../predicate/isBlob.js';
|
|
70
60
|
export { isEqual } from '../predicate/isEqual.js';
|
|
61
|
+
export { isFile } from '../predicate/isFile.js';
|
|
71
62
|
export { isFunction } from '../predicate/isFunction.js';
|
|
72
63
|
export { isJSONArray } from '../predicate/isJSONArray.js';
|
|
73
64
|
export { isJSONObject } from '../predicate/isJSONObject.js';
|
|
@@ -83,7 +74,6 @@ export { withTimeout } from '../promise/withTimeout.js';
|
|
|
83
74
|
export { capitalize } from '../string/capitalize.js';
|
|
84
75
|
export { constantCase } from '../string/constantCase.js';
|
|
85
76
|
export { deburr } from '../string/deburr.js';
|
|
86
|
-
export { escape } from '../string/escape.js';
|
|
87
77
|
export { escapeRegExp } from '../string/escapeRegExp.js';
|
|
88
78
|
export { lowerFirst } from '../string/lowerFirst.js';
|
|
89
79
|
export { pascalCase } from '../string/pascalCase.js';
|
|
@@ -91,9 +81,11 @@ export { unescape } from '../string/unescape.js';
|
|
|
91
81
|
export { upperFirst } from '../string/upperFirst.js';
|
|
92
82
|
export { castArray } from './array/castArray.js';
|
|
93
83
|
export { chunk } from './array/chunk.js';
|
|
84
|
+
export { compact } from './array/compact.js';
|
|
94
85
|
export { concat } from './array/concat.js';
|
|
95
86
|
export { difference } from './array/difference.js';
|
|
96
87
|
export { drop } from './array/drop.js';
|
|
88
|
+
export { dropRight } from './array/dropRight.js';
|
|
97
89
|
export { dropRightWhile } from './array/dropRightWhile.js';
|
|
98
90
|
export { dropWhile } from './array/dropWhile.js';
|
|
99
91
|
export { every } from './array/every.js';
|
|
@@ -105,15 +97,23 @@ export { findLastIndex } from './array/findLastIndex.js';
|
|
|
105
97
|
export { flatten } from './array/flatten.js';
|
|
106
98
|
export { flattenDeep } from './array/flattenDeep.js';
|
|
107
99
|
export { flattenDepth } from './array/flattenDepth.js';
|
|
100
|
+
export { head as first, head } from './array/head.js';
|
|
108
101
|
export { includes } from './array/includes.js';
|
|
109
102
|
export { indexOf } from './array/indexOf.js';
|
|
103
|
+
export { intersection } from './array/intersection.js';
|
|
110
104
|
export { join } from './array/join.js';
|
|
105
|
+
export { last } from './array/last.js';
|
|
111
106
|
export { orderBy } from './array/orderBy.js';
|
|
107
|
+
export { sample } from './array/sample.js';
|
|
112
108
|
export { size } from './array/size.js';
|
|
113
109
|
export { slice } from './array/slice.js';
|
|
114
110
|
export { some } from './array/some.js';
|
|
115
111
|
export { sortBy } from './array/sortBy.js';
|
|
112
|
+
export { tail } from './array/tail.js';
|
|
116
113
|
export { take } from './array/take.js';
|
|
114
|
+
export { takeRight } from './array/takeRight.js';
|
|
115
|
+
export { uniq } from './array/uniq.js';
|
|
116
|
+
export { without } from './array/without.js';
|
|
117
117
|
export { zipObjectDeep } from './array/zipObjectDeep.js';
|
|
118
118
|
export { ary } from './function/ary.js';
|
|
119
119
|
export { attempt } from './function/attempt.js';
|
|
@@ -189,6 +189,7 @@ export { matches } from './predicate/matches.js';
|
|
|
189
189
|
export { matchesProperty } from './predicate/matchesProperty.js';
|
|
190
190
|
export { camelCase } from './string/camelCase.js';
|
|
191
191
|
export { endsWith } from './string/endsWith.js';
|
|
192
|
+
export { escape } from './string/escape.js';
|
|
192
193
|
export { kebabCase } from './string/kebabCase.js';
|
|
193
194
|
export { lowerCase } from './string/lowerCase.js';
|
|
194
195
|
export { pad } from './string/pad.js';
|
|
@@ -211,4 +212,5 @@ export { toInteger } from './util/toInteger.js';
|
|
|
211
212
|
export { toLength } from './util/toLength.js';
|
|
212
213
|
export { toNumber } from './util/toNumber.js';
|
|
213
214
|
export { toPath } from './util/toPath.js';
|
|
215
|
+
export { toSafeInteger } from './util/toSafeInteger.js';
|
|
214
216
|
export { toString } from './util/toString.js';
|
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-Dkv3D1.js');
|
|
6
6
|
const promise_index = require('../_chunk/index-BGZDR9.js');
|
|
7
|
-
const unary = require('../_chunk/unary-
|
|
7
|
+
const unary = require('../_chunk/unary-CMvKXy.js');
|
|
8
8
|
const noop = require('../_chunk/noop-2IwLUk.js');
|
|
9
9
|
const sumBy = require('../_chunk/sumBy-BkErWJ.js');
|
|
10
10
|
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-
|
|
11
|
+
const toMerged = require('../_chunk/toMerged-B5ZVux.js');
|
|
12
|
+
const isPlainObject$1 = require('../_chunk/isPlainObject-octpoD.js');
|
|
13
|
+
const isWeakSet$1 = require('../_chunk/isWeakSet-BuFfzX.js');
|
|
14
14
|
const upperFirst = require('../_chunk/upperFirst-BUECmK.js');
|
|
15
15
|
|
|
16
16
|
function castArray(value) {
|
|
@@ -20,20 +20,27 @@ function castArray(value) {
|
|
|
20
20
|
return Array.isArray(value) ? value : [value];
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
function isArrayLike(value) {
|
|
24
|
+
return value != null && typeof value !== 'function' && isWeakSet$1.isLength(value.length);
|
|
25
|
+
}
|
|
26
|
+
|
|
23
27
|
function chunk(arr, size = 1) {
|
|
24
28
|
size = Math.max(Math.floor(size), 0);
|
|
25
|
-
if (size === 0) {
|
|
29
|
+
if (size === 0 || !isArrayLike(arr)) {
|
|
26
30
|
return [];
|
|
27
31
|
}
|
|
28
|
-
return zipWith.chunk(arr, size);
|
|
32
|
+
return zipWith.chunk(Array.from(arr), size);
|
|
29
33
|
}
|
|
30
34
|
|
|
31
|
-
function
|
|
32
|
-
|
|
35
|
+
function compact(arr) {
|
|
36
|
+
if (!isArrayLike(arr)) {
|
|
37
|
+
return [];
|
|
38
|
+
}
|
|
39
|
+
return zipWith.compact(Array.from(arr));
|
|
33
40
|
}
|
|
34
41
|
|
|
35
|
-
function
|
|
36
|
-
return
|
|
42
|
+
function concat(...values) {
|
|
43
|
+
return zipWith.flatten(values);
|
|
37
44
|
}
|
|
38
45
|
|
|
39
46
|
function isArrayLikeObject(value) {
|
|
@@ -56,11 +63,17 @@ function difference(arr, ...values) {
|
|
|
56
63
|
}
|
|
57
64
|
|
|
58
65
|
function drop(collection, itemsCount) {
|
|
59
|
-
if (collection
|
|
66
|
+
if (!isArrayLike(collection)) {
|
|
67
|
+
return [];
|
|
68
|
+
}
|
|
69
|
+
return zipWith.drop(Array.from(collection), itemsCount);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function dropRight(collection, itemsCount) {
|
|
73
|
+
if (!isArrayLike(collection)) {
|
|
60
74
|
return [];
|
|
61
75
|
}
|
|
62
|
-
|
|
63
|
-
return collection.slice(itemsCount);
|
|
76
|
+
return zipWith.dropRight(Array.from(collection), itemsCount);
|
|
64
77
|
}
|
|
65
78
|
|
|
66
79
|
function isDeepKey(key) {
|
|
@@ -394,6 +407,12 @@ function matchesProperty(property, source) {
|
|
|
394
407
|
}
|
|
395
408
|
|
|
396
409
|
function dropRightWhile(arr, predicate) {
|
|
410
|
+
if (!isArrayLike(arr)) {
|
|
411
|
+
return [];
|
|
412
|
+
}
|
|
413
|
+
return dropRightWhileImpl(Array.from(arr), predicate);
|
|
414
|
+
}
|
|
415
|
+
function dropRightWhileImpl(arr, predicate) {
|
|
397
416
|
switch (typeof predicate) {
|
|
398
417
|
case 'function': {
|
|
399
418
|
return zipWith.dropRightWhile(arr, (item, index, arr) => Boolean(predicate(item, index, arr)));
|
|
@@ -415,6 +434,12 @@ function dropRightWhile(arr, predicate) {
|
|
|
415
434
|
}
|
|
416
435
|
|
|
417
436
|
function dropWhile(arr, predicate) {
|
|
437
|
+
if (!isArrayLike(arr)) {
|
|
438
|
+
return [];
|
|
439
|
+
}
|
|
440
|
+
return dropWhileImpl(Array.from(arr), predicate);
|
|
441
|
+
}
|
|
442
|
+
function dropWhileImpl(arr, predicate) {
|
|
418
443
|
switch (typeof predicate) {
|
|
419
444
|
case 'function': {
|
|
420
445
|
return zipWith.dropWhile(arr, (item, index, arr) => Boolean(predicate(item, index, arr)));
|
|
@@ -651,6 +676,13 @@ function flattenDepth(value, depth = 1) {
|
|
|
651
676
|
return flatten(value, depth);
|
|
652
677
|
}
|
|
653
678
|
|
|
679
|
+
function head(arr) {
|
|
680
|
+
if (!isArrayLike(arr)) {
|
|
681
|
+
return undefined;
|
|
682
|
+
}
|
|
683
|
+
return zipWith.head(Array.from(arr));
|
|
684
|
+
}
|
|
685
|
+
|
|
654
686
|
function isString(value) {
|
|
655
687
|
return typeof value === 'string' || value instanceof String;
|
|
656
688
|
}
|
|
@@ -738,10 +770,35 @@ function indexOf(array, searchElement, fromIndex) {
|
|
|
738
770
|
return array.indexOf(searchElement, fromIndex);
|
|
739
771
|
}
|
|
740
772
|
|
|
773
|
+
function intersection(...arrays) {
|
|
774
|
+
if (arrays.length === 0) {
|
|
775
|
+
return [];
|
|
776
|
+
}
|
|
777
|
+
if (!isArrayLikeObject(arrays[0])) {
|
|
778
|
+
return [];
|
|
779
|
+
}
|
|
780
|
+
let result = zipWith.uniq(Array.from(arrays[0]));
|
|
781
|
+
for (let i = 1; i < arrays.length; i++) {
|
|
782
|
+
const array = arrays[i];
|
|
783
|
+
if (!isArrayLikeObject(array)) {
|
|
784
|
+
return [];
|
|
785
|
+
}
|
|
786
|
+
result = zipWith.intersection(result, Array.from(array));
|
|
787
|
+
}
|
|
788
|
+
return result;
|
|
789
|
+
}
|
|
790
|
+
|
|
741
791
|
function join(array, separator = ',') {
|
|
742
792
|
return array.join(separator);
|
|
743
793
|
}
|
|
744
794
|
|
|
795
|
+
function last(array) {
|
|
796
|
+
if (!isArrayLike(array)) {
|
|
797
|
+
return undefined;
|
|
798
|
+
}
|
|
799
|
+
return zipWith.last(Array.from(array));
|
|
800
|
+
}
|
|
801
|
+
|
|
745
802
|
function getPriority(a) {
|
|
746
803
|
if (typeof a === 'symbol') {
|
|
747
804
|
return 1;
|
|
@@ -859,6 +916,16 @@ function orderBy(collection, criteria, orders) {
|
|
|
859
916
|
.map(item => item.original);
|
|
860
917
|
}
|
|
861
918
|
|
|
919
|
+
function sample(collection) {
|
|
920
|
+
if (collection == null) {
|
|
921
|
+
return undefined;
|
|
922
|
+
}
|
|
923
|
+
if (isArrayLike(collection)) {
|
|
924
|
+
return zipWith.sample(Array.from(collection));
|
|
925
|
+
}
|
|
926
|
+
return zipWith.sample(Object.values(collection));
|
|
927
|
+
}
|
|
928
|
+
|
|
862
929
|
function size(target) {
|
|
863
930
|
if (isWeakSet$1.isNil(target)) {
|
|
864
931
|
return 0;
|
|
@@ -948,11 +1015,39 @@ function sortBy(collection, criteria) {
|
|
|
948
1015
|
return orderBy(collection, criteria, ['asc']);
|
|
949
1016
|
}
|
|
950
1017
|
|
|
951
|
-
function
|
|
952
|
-
if (
|
|
1018
|
+
function tail(arr) {
|
|
1019
|
+
if (!isArrayLike(arr)) {
|
|
953
1020
|
return [];
|
|
954
1021
|
}
|
|
955
|
-
return zipWith.
|
|
1022
|
+
return zipWith.tail(Array.from(arr));
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
function take(arr, count = 1) {
|
|
1026
|
+
if (count < 1 || !isArrayLike(arr)) {
|
|
1027
|
+
return [];
|
|
1028
|
+
}
|
|
1029
|
+
return zipWith.take(Array.from(arr), count);
|
|
1030
|
+
}
|
|
1031
|
+
|
|
1032
|
+
function takeRight(arr, count = 1) {
|
|
1033
|
+
if (count <= 0 || !isArrayLike(arr)) {
|
|
1034
|
+
return [];
|
|
1035
|
+
}
|
|
1036
|
+
return zipWith.takeRight(Array.from(arr), count);
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
function uniq(arr) {
|
|
1040
|
+
if (!isArrayLike(arr)) {
|
|
1041
|
+
return [];
|
|
1042
|
+
}
|
|
1043
|
+
return zipWith.uniq(Array.from(arr));
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
function without(array, ...values) {
|
|
1047
|
+
if (!isArrayLikeObject(array)) {
|
|
1048
|
+
return [];
|
|
1049
|
+
}
|
|
1050
|
+
return zipWith.without(Array.from(array), ...values);
|
|
956
1051
|
}
|
|
957
1052
|
|
|
958
1053
|
function set(obj, path, value) {
|
|
@@ -1607,7 +1702,7 @@ function mergeWithDeep(target, source, merge, stack) {
|
|
|
1607
1702
|
source[i] = source[i] ?? undefined;
|
|
1608
1703
|
}
|
|
1609
1704
|
}
|
|
1610
|
-
const sourceKeys = [...Object.keys(source), ...
|
|
1705
|
+
const sourceKeys = [...Object.keys(source), ...isPlainObject$1.getSymbols(source)];
|
|
1611
1706
|
for (let i = 0; i < sourceKeys.length; i++) {
|
|
1612
1707
|
const key = sourceKeys[i];
|
|
1613
1708
|
let sourceValue = source[key];
|
|
@@ -1780,6 +1875,9 @@ function pick(obj, ...keysArr) {
|
|
|
1780
1875
|
}
|
|
1781
1876
|
for (const key of keys) {
|
|
1782
1877
|
const value = get(obj, key);
|
|
1878
|
+
if (value === undefined && !has(obj, key)) {
|
|
1879
|
+
continue;
|
|
1880
|
+
}
|
|
1783
1881
|
if (typeof key === 'string' && Object.hasOwn(obj, key)) {
|
|
1784
1882
|
result[key] = value;
|
|
1785
1883
|
}
|
|
@@ -1925,6 +2023,10 @@ function endsWith(str, target, position = str.length) {
|
|
|
1925
2023
|
return str.endsWith(target, position);
|
|
1926
2024
|
}
|
|
1927
2025
|
|
|
2026
|
+
function escape(string) {
|
|
2027
|
+
return upperFirst.escape(toString(string));
|
|
2028
|
+
}
|
|
2029
|
+
|
|
1928
2030
|
function kebabCase(str) {
|
|
1929
2031
|
return upperFirst.kebabCase(normalizeForCase(str));
|
|
1930
2032
|
}
|
|
@@ -2078,46 +2180,44 @@ function toLength(value) {
|
|
|
2078
2180
|
return clamp(length, 0, MAX_ARRAY_LENGTH);
|
|
2079
2181
|
}
|
|
2080
2182
|
|
|
2183
|
+
const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER;
|
|
2184
|
+
|
|
2185
|
+
function toSafeInteger(value) {
|
|
2186
|
+
if (value == null) {
|
|
2187
|
+
return 0;
|
|
2188
|
+
}
|
|
2189
|
+
return clamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER);
|
|
2190
|
+
}
|
|
2191
|
+
|
|
2081
2192
|
exports.at = zipWith.at;
|
|
2082
|
-
exports.compact = zipWith.compact;
|
|
2083
2193
|
exports.countBy = zipWith.countBy;
|
|
2084
2194
|
exports.differenceBy = zipWith.differenceBy;
|
|
2085
2195
|
exports.differenceWith = zipWith.differenceWith;
|
|
2086
|
-
exports.dropRight = zipWith.dropRight;
|
|
2087
|
-
exports.first = zipWith.head;
|
|
2088
2196
|
exports.flatMap = zipWith.flatMap;
|
|
2089
2197
|
exports.flatMapDeep = zipWith.flatMapDeep;
|
|
2090
2198
|
exports.forEachRight = zipWith.forEachRight;
|
|
2091
2199
|
exports.groupBy = zipWith.groupBy;
|
|
2092
|
-
exports.head = zipWith.head;
|
|
2093
2200
|
exports.initial = zipWith.initial;
|
|
2094
|
-
exports.intersection = zipWith.intersection;
|
|
2095
2201
|
exports.intersectionBy = zipWith.intersectionBy;
|
|
2096
2202
|
exports.intersectionWith = zipWith.intersectionWith;
|
|
2097
2203
|
exports.isSubset = zipWith.isSubset;
|
|
2098
2204
|
exports.keyBy = zipWith.keyBy;
|
|
2099
|
-
exports.last = zipWith.last;
|
|
2100
2205
|
exports.maxBy = zipWith.maxBy;
|
|
2101
2206
|
exports.minBy = zipWith.minBy;
|
|
2102
2207
|
exports.partition = zipWith.partition;
|
|
2103
2208
|
exports.pullAt = zipWith.pullAt;
|
|
2104
|
-
exports.sample = zipWith.sample;
|
|
2105
2209
|
exports.sampleSize = zipWith.sampleSize;
|
|
2106
2210
|
exports.shuffle = zipWith.shuffle;
|
|
2107
|
-
exports.tail = zipWith.tail;
|
|
2108
|
-
exports.takeRight = zipWith.takeRight;
|
|
2109
2211
|
exports.takeRightWhile = zipWith.takeRightWhile;
|
|
2110
2212
|
exports.takeWhile = zipWith.takeWhile;
|
|
2111
2213
|
exports.toFilled = zipWith.toFilled;
|
|
2112
2214
|
exports.union = zipWith.union;
|
|
2113
2215
|
exports.unionBy = zipWith.unionBy;
|
|
2114
2216
|
exports.unionWith = zipWith.unionWith;
|
|
2115
|
-
exports.uniq = zipWith.uniq;
|
|
2116
2217
|
exports.uniqBy = zipWith.uniqBy;
|
|
2117
2218
|
exports.uniqWith = zipWith.uniqWith;
|
|
2118
2219
|
exports.unzip = zipWith.unzip;
|
|
2119
2220
|
exports.unzipWith = zipWith.unzipWith;
|
|
2120
|
-
exports.without = zipWith.without;
|
|
2121
2221
|
exports.xor = zipWith.xor;
|
|
2122
2222
|
exports.xorBy = zipWith.xorBy;
|
|
2123
2223
|
exports.xorWith = zipWith.xorWith;
|
|
@@ -2155,6 +2255,7 @@ exports.isPrimitive = isPlainObject$1.isPrimitive;
|
|
|
2155
2255
|
exports.eq = isWeakSet$1.eq;
|
|
2156
2256
|
exports.isBlob = isWeakSet$1.isBlob;
|
|
2157
2257
|
exports.isEqual = isWeakSet$1.isEqual;
|
|
2258
|
+
exports.isFile = isWeakSet$1.isFile;
|
|
2158
2259
|
exports.isFunction = isWeakSet$1.isFunction;
|
|
2159
2260
|
exports.isJSONArray = isWeakSet$1.isJSONArray;
|
|
2160
2261
|
exports.isJSONObject = isWeakSet$1.isJSONObject;
|
|
@@ -2166,7 +2267,6 @@ exports.isUndefined = isWeakSet$1.isUndefined;
|
|
|
2166
2267
|
exports.capitalize = upperFirst.capitalize;
|
|
2167
2268
|
exports.constantCase = upperFirst.constantCase;
|
|
2168
2269
|
exports.deburr = upperFirst.deburr;
|
|
2169
|
-
exports.escape = upperFirst.escape;
|
|
2170
2270
|
exports.escapeRegExp = upperFirst.escapeRegExp;
|
|
2171
2271
|
exports.lowerFirst = upperFirst.lowerFirst;
|
|
2172
2272
|
exports.pascalCase = upperFirst.pascalCase;
|
|
@@ -2183,6 +2283,7 @@ exports.ceil = ceil;
|
|
|
2183
2283
|
exports.chunk = chunk;
|
|
2184
2284
|
exports.clamp = clamp;
|
|
2185
2285
|
exports.cloneDeep = cloneDeep;
|
|
2286
|
+
exports.compact = compact;
|
|
2186
2287
|
exports.concat = concat;
|
|
2187
2288
|
exports.conforms = conforms;
|
|
2188
2289
|
exports.conformsTo = conformsTo;
|
|
@@ -2195,15 +2296,18 @@ exports.defaults = defaults;
|
|
|
2195
2296
|
exports.defer = defer;
|
|
2196
2297
|
exports.difference = difference;
|
|
2197
2298
|
exports.drop = drop;
|
|
2299
|
+
exports.dropRight = dropRight;
|
|
2198
2300
|
exports.dropRightWhile = dropRightWhile;
|
|
2199
2301
|
exports.dropWhile = dropWhile;
|
|
2200
2302
|
exports.endsWith = endsWith;
|
|
2303
|
+
exports.escape = escape;
|
|
2201
2304
|
exports.every = every;
|
|
2202
2305
|
exports.fill = fill;
|
|
2203
2306
|
exports.filter = filter;
|
|
2204
2307
|
exports.find = find;
|
|
2205
2308
|
exports.findIndex = findIndex;
|
|
2206
2309
|
exports.findLastIndex = findLastIndex;
|
|
2310
|
+
exports.first = head;
|
|
2207
2311
|
exports.flatten = flatten;
|
|
2208
2312
|
exports.flattenDeep = flattenDeep;
|
|
2209
2313
|
exports.flattenDepth = flattenDepth;
|
|
@@ -2214,9 +2318,11 @@ exports.flowRight = flowRight;
|
|
|
2214
2318
|
exports.fromPairs = fromPairs;
|
|
2215
2319
|
exports.get = get;
|
|
2216
2320
|
exports.has = has;
|
|
2321
|
+
exports.head = head;
|
|
2217
2322
|
exports.inRange = inRange;
|
|
2218
2323
|
exports.includes = includes;
|
|
2219
2324
|
exports.indexOf = indexOf;
|
|
2325
|
+
exports.intersection = intersection;
|
|
2220
2326
|
exports.invertBy = invertBy;
|
|
2221
2327
|
exports.isArguments = isArguments;
|
|
2222
2328
|
exports.isArray = isArray;
|
|
@@ -2246,6 +2352,7 @@ exports.isWeakMap = isWeakMap;
|
|
|
2246
2352
|
exports.isWeakSet = isWeakSet;
|
|
2247
2353
|
exports.join = join;
|
|
2248
2354
|
exports.kebabCase = kebabCase;
|
|
2355
|
+
exports.last = last;
|
|
2249
2356
|
exports.lowerCase = lowerCase;
|
|
2250
2357
|
exports.mapKeys = mapKeys;
|
|
2251
2358
|
exports.mapValues = mapValues;
|
|
@@ -2268,6 +2375,7 @@ exports.rearg = rearg;
|
|
|
2268
2375
|
exports.repeat = repeat;
|
|
2269
2376
|
exports.rest = rest;
|
|
2270
2377
|
exports.round = round;
|
|
2378
|
+
exports.sample = sample;
|
|
2271
2379
|
exports.set = set;
|
|
2272
2380
|
exports.size = size;
|
|
2273
2381
|
exports.slice = slice;
|
|
@@ -2277,7 +2385,9 @@ exports.sortBy = sortBy;
|
|
|
2277
2385
|
exports.spread = spread;
|
|
2278
2386
|
exports.startCase = startCase;
|
|
2279
2387
|
exports.startsWith = startsWith;
|
|
2388
|
+
exports.tail = tail;
|
|
2280
2389
|
exports.take = take;
|
|
2390
|
+
exports.takeRight = takeRight;
|
|
2281
2391
|
exports.throttle = throttle;
|
|
2282
2392
|
exports.times = times;
|
|
2283
2393
|
exports.toDefaulted = toDefaulted;
|
|
@@ -2286,10 +2396,13 @@ exports.toInteger = toInteger;
|
|
|
2286
2396
|
exports.toLength = toLength;
|
|
2287
2397
|
exports.toNumber = toNumber;
|
|
2288
2398
|
exports.toPath = toPath;
|
|
2399
|
+
exports.toSafeInteger = toSafeInteger;
|
|
2289
2400
|
exports.toString = toString;
|
|
2290
2401
|
exports.trim = trim;
|
|
2291
2402
|
exports.trimEnd = trimEnd;
|
|
2292
2403
|
exports.trimStart = trimStart;
|
|
2404
|
+
exports.uniq = uniq;
|
|
2293
2405
|
exports.unset = unset;
|
|
2294
2406
|
exports.upperCase = upperCase;
|
|
2407
|
+
exports.without = without;
|
|
2295
2408
|
exports.zipObjectDeep = zipObjectDeep;
|
package/dist/compat/index.mjs
CHANGED
|
@@ -1,42 +1,32 @@
|
|
|
1
1
|
export { at } from '../array/at.mjs';
|
|
2
|
-
export { compact } from '../array/compact.mjs';
|
|
3
2
|
export { countBy } from '../array/countBy.mjs';
|
|
4
3
|
export { differenceBy } from '../array/differenceBy.mjs';
|
|
5
4
|
export { differenceWith } from '../array/differenceWith.mjs';
|
|
6
|
-
export { dropRight } from '../array/dropRight.mjs';
|
|
7
5
|
export { flatMap } from '../array/flatMap.mjs';
|
|
8
6
|
export { flatMapDeep } from '../array/flatMapDeep.mjs';
|
|
9
7
|
export { forEachRight } from '../array/forEachRight.mjs';
|
|
10
8
|
export { groupBy } from '../array/groupBy.mjs';
|
|
11
|
-
export { head as first, head } from '../array/head.mjs';
|
|
12
9
|
export { initial } from '../array/initial.mjs';
|
|
13
|
-
export { intersection } from '../array/intersection.mjs';
|
|
14
10
|
export { intersectionBy } from '../array/intersectionBy.mjs';
|
|
15
11
|
export { intersectionWith } from '../array/intersectionWith.mjs';
|
|
16
12
|
export { isSubset } from '../array/isSubset.mjs';
|
|
17
13
|
export { keyBy } from '../array/keyBy.mjs';
|
|
18
|
-
export { last } from '../array/last.mjs';
|
|
19
14
|
export { maxBy } from '../array/maxBy.mjs';
|
|
20
15
|
export { minBy } from '../array/minBy.mjs';
|
|
21
16
|
export { partition } from '../array/partition.mjs';
|
|
22
17
|
export { pullAt } from '../array/pullAt.mjs';
|
|
23
|
-
export { sample } from '../array/sample.mjs';
|
|
24
18
|
export { sampleSize } from '../array/sampleSize.mjs';
|
|
25
19
|
export { shuffle } from '../array/shuffle.mjs';
|
|
26
|
-
export { tail } from '../array/tail.mjs';
|
|
27
|
-
export { takeRight } from '../array/takeRight.mjs';
|
|
28
20
|
export { takeRightWhile } from '../array/takeRightWhile.mjs';
|
|
29
21
|
export { takeWhile } from '../array/takeWhile.mjs';
|
|
30
22
|
export { toFilled } from '../array/toFilled.mjs';
|
|
31
23
|
export { union } from '../array/union.mjs';
|
|
32
24
|
export { unionBy } from '../array/unionBy.mjs';
|
|
33
25
|
export { unionWith } from '../array/unionWith.mjs';
|
|
34
|
-
export { uniq } from '../array/uniq.mjs';
|
|
35
26
|
export { uniqBy } from '../array/uniqBy.mjs';
|
|
36
27
|
export { uniqWith } from '../array/uniqWith.mjs';
|
|
37
28
|
export { unzip } from '../array/unzip.mjs';
|
|
38
29
|
export { unzipWith } from '../array/unzipWith.mjs';
|
|
39
|
-
export { without } from '../array/without.mjs';
|
|
40
30
|
export { xor } from '../array/xor.mjs';
|
|
41
31
|
export { xorBy } from '../array/xorBy.mjs';
|
|
42
32
|
export { xorWith } from '../array/xorWith.mjs';
|
|
@@ -71,6 +61,7 @@ export { toMerged } from '../object/toMerged.mjs';
|
|
|
71
61
|
export { isBlob } from '../predicate/isBlob.mjs';
|
|
72
62
|
export { isEqual } from '../predicate/isEqual.mjs';
|
|
73
63
|
export { eq } from './util/eq.mjs';
|
|
64
|
+
export { isFile } from '../predicate/isFile.mjs';
|
|
74
65
|
export { isFunction } from '../predicate/isFunction.mjs';
|
|
75
66
|
export { isJSONArray } from '../predicate/isJSONArray.mjs';
|
|
76
67
|
export { isJSONObject } from '../predicate/isJSONObject.mjs';
|
|
@@ -85,7 +76,6 @@ export { withTimeout } from '../promise/withTimeout.mjs';
|
|
|
85
76
|
export { capitalize } from '../string/capitalize.mjs';
|
|
86
77
|
export { constantCase } from '../string/constantCase.mjs';
|
|
87
78
|
export { deburr } from '../string/deburr.mjs';
|
|
88
|
-
export { escape } from '../string/escape.mjs';
|
|
89
79
|
export { escapeRegExp } from '../string/escapeRegExp.mjs';
|
|
90
80
|
export { lowerFirst } from '../string/lowerFirst.mjs';
|
|
91
81
|
export { pascalCase } from '../string/pascalCase.mjs';
|
|
@@ -93,9 +83,11 @@ export { unescape } from '../string/unescape.mjs';
|
|
|
93
83
|
export { upperFirst } from '../string/upperFirst.mjs';
|
|
94
84
|
export { castArray } from './array/castArray.mjs';
|
|
95
85
|
export { chunk } from './array/chunk.mjs';
|
|
86
|
+
export { compact } from './array/compact.mjs';
|
|
96
87
|
export { concat } from './array/concat.mjs';
|
|
97
88
|
export { difference } from './array/difference.mjs';
|
|
98
89
|
export { drop } from './array/drop.mjs';
|
|
90
|
+
export { dropRight } from './array/dropRight.mjs';
|
|
99
91
|
export { dropRightWhile } from './array/dropRightWhile.mjs';
|
|
100
92
|
export { dropWhile } from './array/dropWhile.mjs';
|
|
101
93
|
export { every } from './array/every.mjs';
|
|
@@ -107,15 +99,23 @@ export { findLastIndex } from './array/findLastIndex.mjs';
|
|
|
107
99
|
export { flatten } from './array/flatten.mjs';
|
|
108
100
|
export { flattenDeep } from './array/flattenDeep.mjs';
|
|
109
101
|
export { flattenDepth } from './array/flattenDepth.mjs';
|
|
102
|
+
export { head as first, head } from './array/head.mjs';
|
|
110
103
|
export { includes } from './array/includes.mjs';
|
|
111
104
|
export { indexOf } from './array/indexOf.mjs';
|
|
105
|
+
export { intersection } from './array/intersection.mjs';
|
|
112
106
|
export { join } from './array/join.mjs';
|
|
107
|
+
export { last } from './array/last.mjs';
|
|
113
108
|
export { orderBy } from './array/orderBy.mjs';
|
|
109
|
+
export { sample } from './array/sample.mjs';
|
|
114
110
|
export { size } from './array/size.mjs';
|
|
115
111
|
export { slice } from './array/slice.mjs';
|
|
116
112
|
export { some } from './array/some.mjs';
|
|
117
113
|
export { sortBy } from './array/sortBy.mjs';
|
|
114
|
+
export { tail } from './array/tail.mjs';
|
|
118
115
|
export { take } from './array/take.mjs';
|
|
116
|
+
export { takeRight } from './array/takeRight.mjs';
|
|
117
|
+
export { uniq } from './array/uniq.mjs';
|
|
118
|
+
export { without } from './array/without.mjs';
|
|
119
119
|
export { zipObjectDeep } from './array/zipObjectDeep.mjs';
|
|
120
120
|
export { ary } from './function/ary.mjs';
|
|
121
121
|
export { attempt } from './function/attempt.mjs';
|
|
@@ -190,6 +190,7 @@ export { matches } from './predicate/matches.mjs';
|
|
|
190
190
|
export { matchesProperty } from './predicate/matchesProperty.mjs';
|
|
191
191
|
export { camelCase } from './string/camelCase.mjs';
|
|
192
192
|
export { endsWith } from './string/endsWith.mjs';
|
|
193
|
+
export { escape } from './string/escape.mjs';
|
|
193
194
|
export { kebabCase } from './string/kebabCase.mjs';
|
|
194
195
|
export { lowerCase } from './string/lowerCase.mjs';
|
|
195
196
|
export { pad } from './string/pad.mjs';
|
|
@@ -211,4 +212,5 @@ export { toInteger } from './util/toInteger.mjs';
|
|
|
211
212
|
export { toLength } from './util/toLength.mjs';
|
|
212
213
|
export { toNumber } from './util/toNumber.mjs';
|
|
213
214
|
export { toPath } from './util/toPath.mjs';
|
|
215
|
+
export { toSafeInteger } from './util/toSafeInteger.mjs';
|
|
214
216
|
export { toString } from './util/toString.mjs';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { get } from './get.mjs';
|
|
2
|
+
import { has } from './has.mjs';
|
|
2
3
|
import { set } from './set.mjs';
|
|
3
4
|
import { isNil } from '../predicate/isNil.mjs';
|
|
4
5
|
|
|
@@ -25,6 +26,9 @@ function pick(obj, ...keysArr) {
|
|
|
25
26
|
}
|
|
26
27
|
for (const key of keys) {
|
|
27
28
|
const value = get(obj, key);
|
|
29
|
+
if (value === undefined && !has(obj, key)) {
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
28
32
|
if (typeof key === 'string' && Object.hasOwn(obj, key)) {
|
|
29
33
|
result[key] = value;
|
|
30
34
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts the characters "&", "<", ">", '"', and "'" in `str` to their corresponding HTML entities.
|
|
3
|
+
* For example, "<" becomes "<".
|
|
4
|
+
*
|
|
5
|
+
* @param {string} str The string to escape.
|
|
6
|
+
* @returns {string} Returns the escaped string.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* escape('This is a <div> element.'); // returns 'This is a <div> element.'
|
|
10
|
+
* escape('This is a "quote"'); // returns 'This is a "quote"'
|
|
11
|
+
* escape("This is a 'quote'"); // returns 'This is a 'quote''
|
|
12
|
+
* escape('This is a & symbol'); // returns 'This is a & symbol'
|
|
13
|
+
*/
|
|
14
|
+
declare function escape(string?: string): string;
|
|
15
|
+
|
|
16
|
+
export { escape };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts the characters "&", "<", ">", '"', and "'" in `str` to their corresponding HTML entities.
|
|
3
|
+
* For example, "<" becomes "<".
|
|
4
|
+
*
|
|
5
|
+
* @param {string} str The string to escape.
|
|
6
|
+
* @returns {string} Returns the escaped string.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* escape('This is a <div> element.'); // returns 'This is a <div> element.'
|
|
10
|
+
* escape('This is a "quote"'); // returns 'This is a "quote"'
|
|
11
|
+
* escape("This is a 'quote'"); // returns 'This is a 'quote''
|
|
12
|
+
* escape('This is a & symbol'); // returns 'This is a & symbol'
|
|
13
|
+
*/
|
|
14
|
+
declare function escape(string?: string): string;
|
|
15
|
+
|
|
16
|
+
export { escape };
|