es-toolkit 1.36.0 → 1.37.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/CHANGELOG.md +15 -0
- package/dist/_chunk/isPlainObject-Xaozpc.js +93 -0
- package/dist/_chunk/{isPromise-CxqI1v.js → isWeakSet-C2NpfO.js} +91 -177
- package/dist/_chunk/snakeCase-BwvoPi.js +30 -0
- package/dist/_chunk/toSnakeCaseKeys-kqZCyq.js +379 -0
- package/dist/_chunk/{reverseString-BixeGz.js → upperFirst-DbrFSz.js} +19 -45
- package/dist/_chunk/{zip-BJSrRi.js → zip-DDfXXG.js} +0 -24
- package/dist/array/index.js +25 -4
- package/dist/browser.global.js +1 -1
- package/dist/browser.global.js.map +1 -1
- package/dist/compat/_internal/compareValues.mjs +0 -3
- package/dist/compat/array/sampleSize.d.mts +38 -0
- package/dist/compat/array/sampleSize.d.ts +38 -0
- package/dist/compat/array/sampleSize.mjs +18 -0
- package/dist/compat/array/unzipWith.d.mts +78 -0
- package/dist/compat/array/unzipWith.d.ts +78 -0
- package/dist/compat/array/unzipWith.mjs +21 -0
- package/dist/compat/array/xor.d.mts +23 -0
- package/dist/compat/array/xor.d.ts +23 -0
- package/dist/compat/array/xor.mjs +30 -0
- package/dist/compat/compat.d.mts +6 -4
- package/dist/compat/compat.d.ts +6 -4
- package/dist/compat/compat.mjs +7 -5
- package/dist/compat/index.d.mts +6 -4
- package/dist/compat/index.d.ts +6 -4
- package/dist/compat/index.js +4678 -309
- package/dist/compat/index.mjs +7 -5
- package/dist/compat/object/omitBy.d.mts +22 -0
- package/dist/compat/object/omitBy.d.ts +22 -0
- package/dist/compat/object/omitBy.mjs +26 -0
- package/dist/compat/object/result.d.mts +33 -0
- package/dist/compat/object/result.d.ts +33 -0
- package/dist/compat/object/result.mjs +24 -0
- package/dist/compat/object/transform.d.mts +59 -0
- package/dist/compat/object/transform.d.ts +59 -0
- package/dist/compat/object/transform.mjs +30 -0
- package/dist/compat/util/toString.mjs +3 -0
- package/dist/index.js +71 -69
- package/dist/object/index.js +28 -15
- package/dist/object/toCamelCaseKeys.mjs +2 -12
- package/dist/object/toSnakeCaseKeys.mjs +1 -11
- package/dist/predicate/index.js +31 -30
- package/dist/string/index.js +23 -22
- package/package.json +1 -1
- package/dist/_chunk/toSnakeCaseKeys-DZO2eB.js +0 -4901
package/dist/object/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const toSnakeCaseKeys = require('../_chunk/toSnakeCaseKeys-kqZCyq.js');
|
|
6
6
|
|
|
7
7
|
function mergeWith(target, source, merge) {
|
|
8
8
|
const sourceKeys = Object.keys(source);
|
|
@@ -17,7 +17,7 @@ function mergeWith(target, source, merge) {
|
|
|
17
17
|
else if (Array.isArray(sourceValue)) {
|
|
18
18
|
target[key] = mergeWith(targetValue ?? [], sourceValue, merge);
|
|
19
19
|
}
|
|
20
|
-
else if (
|
|
20
|
+
else if (toSnakeCaseKeys.isObjectLike(targetValue) && toSnakeCaseKeys.isObjectLike(sourceValue)) {
|
|
21
21
|
target[key] = mergeWith(targetValue ?? {}, sourceValue, merge);
|
|
22
22
|
}
|
|
23
23
|
else if (targetValue === undefined || sourceValue !== undefined) {
|
|
@@ -36,6 +36,19 @@ function omit(obj, keys) {
|
|
|
36
36
|
return result;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
function omitBy(obj, shouldOmit) {
|
|
40
|
+
const result = {};
|
|
41
|
+
const keys = Object.keys(obj);
|
|
42
|
+
for (let i = 0; i < keys.length; i++) {
|
|
43
|
+
const key = keys[i];
|
|
44
|
+
const value = obj[key];
|
|
45
|
+
if (!shouldOmit(value, key)) {
|
|
46
|
+
result[key] = value;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return result;
|
|
50
|
+
}
|
|
51
|
+
|
|
39
52
|
function pick(obj, keys) {
|
|
40
53
|
const result = {};
|
|
41
54
|
for (let i = 0; i < keys.length; i++) {
|
|
@@ -60,20 +73,20 @@ function pickBy(obj, shouldPick) {
|
|
|
60
73
|
return result;
|
|
61
74
|
}
|
|
62
75
|
|
|
63
|
-
exports.clone =
|
|
64
|
-
exports.cloneDeep =
|
|
65
|
-
exports.cloneDeepWith =
|
|
66
|
-
exports.findKey =
|
|
67
|
-
exports.flattenObject =
|
|
68
|
-
exports.invert =
|
|
69
|
-
exports.mapKeys =
|
|
70
|
-
exports.mapValues =
|
|
71
|
-
exports.merge =
|
|
72
|
-
exports.
|
|
73
|
-
exports.
|
|
74
|
-
exports.
|
|
75
|
-
exports.toSnakeCaseKeys = compat_index.toSnakeCaseKeys;
|
|
76
|
+
exports.clone = toSnakeCaseKeys.clone;
|
|
77
|
+
exports.cloneDeep = toSnakeCaseKeys.cloneDeep;
|
|
78
|
+
exports.cloneDeepWith = toSnakeCaseKeys.cloneDeepWith;
|
|
79
|
+
exports.findKey = toSnakeCaseKeys.findKey;
|
|
80
|
+
exports.flattenObject = toSnakeCaseKeys.flattenObject;
|
|
81
|
+
exports.invert = toSnakeCaseKeys.invert;
|
|
82
|
+
exports.mapKeys = toSnakeCaseKeys.mapKeys;
|
|
83
|
+
exports.mapValues = toSnakeCaseKeys.mapValues;
|
|
84
|
+
exports.merge = toSnakeCaseKeys.merge;
|
|
85
|
+
exports.toCamelCaseKeys = toSnakeCaseKeys.toCamelCaseKeys;
|
|
86
|
+
exports.toMerged = toSnakeCaseKeys.toMerged;
|
|
87
|
+
exports.toSnakeCaseKeys = toSnakeCaseKeys.toSnakeCaseKeys;
|
|
76
88
|
exports.mergeWith = mergeWith;
|
|
77
89
|
exports.omit = omit;
|
|
90
|
+
exports.omitBy = omitBy;
|
|
78
91
|
exports.pick = pick;
|
|
79
92
|
exports.pickBy = pickBy;
|
|
@@ -1,16 +1,6 @@
|
|
|
1
|
-
import '../function/partial.mjs';
|
|
2
|
-
import '../function/partialRight.mjs';
|
|
3
|
-
import { camelCase } from '../string/camelCase.mjs';
|
|
4
|
-
import '../string/deburr.mjs';
|
|
5
1
|
import { isArray } from '../compat/predicate/isArray.mjs';
|
|
6
|
-
import '../
|
|
7
|
-
import '../
|
|
8
|
-
import '../compat/function/curry.mjs';
|
|
9
|
-
import '../compat/function/curryRight.mjs';
|
|
10
|
-
import '../compat/function/partial.mjs';
|
|
11
|
-
import '../compat/function/partialRight.mjs';
|
|
12
|
-
import { isPlainObject } from '../compat/predicate/isPlainObject.mjs';
|
|
13
|
-
import '../compat/toolkit.mjs';
|
|
2
|
+
import { isPlainObject } from '../predicate/isPlainObject.mjs';
|
|
3
|
+
import { camelCase } from '../string/camelCase.mjs';
|
|
14
4
|
|
|
15
5
|
function toCamelCaseKeys(obj) {
|
|
16
6
|
if (isArray(obj)) {
|
|
@@ -1,16 +1,6 @@
|
|
|
1
|
-
import '../function/partial.mjs';
|
|
2
|
-
import '../function/partialRight.mjs';
|
|
3
|
-
import { snakeCase } from '../string/snakeCase.mjs';
|
|
4
|
-
import '../string/deburr.mjs';
|
|
5
1
|
import { isArray } from '../compat/predicate/isArray.mjs';
|
|
6
|
-
import '../compat/function/bind.mjs';
|
|
7
|
-
import '../compat/function/bindKey.mjs';
|
|
8
|
-
import '../compat/function/curry.mjs';
|
|
9
|
-
import '../compat/function/curryRight.mjs';
|
|
10
|
-
import '../compat/function/partial.mjs';
|
|
11
|
-
import '../compat/function/partialRight.mjs';
|
|
12
2
|
import { isPlainObject } from '../compat/predicate/isPlainObject.mjs';
|
|
13
|
-
import '../
|
|
3
|
+
import { snakeCase } from '../string/snakeCase.mjs';
|
|
14
4
|
|
|
15
5
|
function toSnakeCaseKeys(obj) {
|
|
16
6
|
if (isArray(obj)) {
|
package/dist/predicate/index.js
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const isWeakSet = require('../_chunk/isWeakSet-C2NpfO.js');
|
|
6
|
+
const isPlainObject = require('../_chunk/isPlainObject-Xaozpc.js');
|
|
6
7
|
|
|
7
8
|
function isBoolean(x) {
|
|
8
9
|
return typeof x === 'boolean';
|
|
@@ -16,35 +17,35 @@ function isString(value) {
|
|
|
16
17
|
return typeof value === 'string';
|
|
17
18
|
}
|
|
18
19
|
|
|
19
|
-
exports.isArrayBuffer =
|
|
20
|
-
exports.isBlob =
|
|
21
|
-
exports.isBrowser =
|
|
22
|
-
exports.isBuffer =
|
|
23
|
-
exports.isDate =
|
|
24
|
-
exports.isEqual =
|
|
25
|
-
exports.isEqualWith =
|
|
26
|
-
exports.isFile =
|
|
27
|
-
exports.isFunction =
|
|
28
|
-
exports.isJSON =
|
|
29
|
-
exports.isJSONArray =
|
|
30
|
-
exports.isJSONObject =
|
|
31
|
-
exports.isJSONValue =
|
|
32
|
-
exports.isLength =
|
|
33
|
-
exports.isMap =
|
|
34
|
-
exports.isNil =
|
|
35
|
-
exports.isNode =
|
|
36
|
-
exports.isNotNil =
|
|
37
|
-
exports.isNull =
|
|
38
|
-
exports.
|
|
39
|
-
exports.
|
|
40
|
-
exports.
|
|
41
|
-
exports.
|
|
42
|
-
exports.
|
|
43
|
-
exports.
|
|
44
|
-
exports.
|
|
45
|
-
exports.
|
|
46
|
-
exports.
|
|
47
|
-
exports.
|
|
20
|
+
exports.isArrayBuffer = isWeakSet.isArrayBuffer;
|
|
21
|
+
exports.isBlob = isWeakSet.isBlob;
|
|
22
|
+
exports.isBrowser = isWeakSet.isBrowser;
|
|
23
|
+
exports.isBuffer = isWeakSet.isBuffer;
|
|
24
|
+
exports.isDate = isWeakSet.isDate;
|
|
25
|
+
exports.isEqual = isWeakSet.isEqual;
|
|
26
|
+
exports.isEqualWith = isWeakSet.isEqualWith;
|
|
27
|
+
exports.isFile = isWeakSet.isFile;
|
|
28
|
+
exports.isFunction = isWeakSet.isFunction;
|
|
29
|
+
exports.isJSON = isWeakSet.isJSON;
|
|
30
|
+
exports.isJSONArray = isWeakSet.isJSONArray;
|
|
31
|
+
exports.isJSONObject = isWeakSet.isJSONObject;
|
|
32
|
+
exports.isJSONValue = isWeakSet.isJSONValue;
|
|
33
|
+
exports.isLength = isWeakSet.isLength;
|
|
34
|
+
exports.isMap = isWeakSet.isMap;
|
|
35
|
+
exports.isNil = isWeakSet.isNil;
|
|
36
|
+
exports.isNode = isWeakSet.isNode;
|
|
37
|
+
exports.isNotNil = isWeakSet.isNotNil;
|
|
38
|
+
exports.isNull = isWeakSet.isNull;
|
|
39
|
+
exports.isPromise = isWeakSet.isPromise;
|
|
40
|
+
exports.isRegExp = isWeakSet.isRegExp;
|
|
41
|
+
exports.isSet = isWeakSet.isSet;
|
|
42
|
+
exports.isSymbol = isWeakSet.isSymbol;
|
|
43
|
+
exports.isUndefined = isWeakSet.isUndefined;
|
|
44
|
+
exports.isWeakMap = isWeakSet.isWeakMap;
|
|
45
|
+
exports.isWeakSet = isWeakSet.isWeakSet;
|
|
46
|
+
exports.isPlainObject = isPlainObject.isPlainObject;
|
|
47
|
+
exports.isPrimitive = isPlainObject.isPrimitive;
|
|
48
|
+
exports.isTypedArray = isPlainObject.isTypedArray;
|
|
48
49
|
exports.isBoolean = isBoolean;
|
|
49
50
|
exports.isError = isError;
|
|
50
51
|
exports.isString = isString;
|
package/dist/string/index.js
CHANGED
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const snakeCase = require('../_chunk/snakeCase-BwvoPi.js');
|
|
6
|
+
const upperFirst = require('../_chunk/upperFirst-DbrFSz.js');
|
|
6
7
|
|
|
7
8
|
function startCase(str) {
|
|
8
|
-
const words =
|
|
9
|
+
const words = snakeCase.words(str.trim());
|
|
9
10
|
let result = '';
|
|
10
11
|
for (let i = 0; i < words.length; i++) {
|
|
11
12
|
const word = words[i];
|
|
@@ -17,24 +18,24 @@ function startCase(str) {
|
|
|
17
18
|
return result;
|
|
18
19
|
}
|
|
19
20
|
|
|
20
|
-
exports.camelCase =
|
|
21
|
-
exports.capitalize =
|
|
22
|
-
exports.
|
|
23
|
-
exports.
|
|
24
|
-
exports.
|
|
25
|
-
exports.
|
|
26
|
-
exports.
|
|
27
|
-
exports.
|
|
28
|
-
exports.
|
|
29
|
-
exports.
|
|
30
|
-
exports.
|
|
31
|
-
exports.
|
|
32
|
-
exports.
|
|
33
|
-
exports.
|
|
34
|
-
exports.
|
|
35
|
-
exports.
|
|
36
|
-
exports.
|
|
37
|
-
exports.
|
|
38
|
-
exports.
|
|
39
|
-
exports.
|
|
21
|
+
exports.camelCase = snakeCase.camelCase;
|
|
22
|
+
exports.capitalize = snakeCase.capitalize;
|
|
23
|
+
exports.snakeCase = snakeCase.snakeCase;
|
|
24
|
+
exports.words = snakeCase.words;
|
|
25
|
+
exports.constantCase = upperFirst.constantCase;
|
|
26
|
+
exports.deburr = upperFirst.deburr;
|
|
27
|
+
exports.escape = upperFirst.escape;
|
|
28
|
+
exports.escapeRegExp = upperFirst.escapeRegExp;
|
|
29
|
+
exports.kebabCase = upperFirst.kebabCase;
|
|
30
|
+
exports.lowerCase = upperFirst.lowerCase;
|
|
31
|
+
exports.lowerFirst = upperFirst.lowerFirst;
|
|
32
|
+
exports.pad = upperFirst.pad;
|
|
33
|
+
exports.pascalCase = upperFirst.pascalCase;
|
|
34
|
+
exports.reverseString = upperFirst.reverseString;
|
|
35
|
+
exports.trim = upperFirst.trim;
|
|
36
|
+
exports.trimEnd = upperFirst.trimEnd;
|
|
37
|
+
exports.trimStart = upperFirst.trimStart;
|
|
38
|
+
exports.unescape = upperFirst.unescape;
|
|
39
|
+
exports.upperCase = upperFirst.upperCase;
|
|
40
|
+
exports.upperFirst = upperFirst.upperFirst;
|
|
40
41
|
exports.startCase = startCase;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "es-toolkit",
|
|
3
3
|
"description": "A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.37.0",
|
|
5
5
|
"homepage": "https://es-toolkit.slash.page",
|
|
6
6
|
"bugs": "https://github.com/toss/es-toolkit/issues",
|
|
7
7
|
"repository": {
|