es-toolkit 1.13.1-dev.365 → 1.13.1-dev.367
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/browser.global.js +1 -1
- package/dist/browser.global.js.map +1 -1
- package/dist/compat/index.js +4 -4
- package/dist/index.js +4 -4
- package/dist/object/cloneDeep.mjs +2 -2
- package/dist/object/index.js +6 -6
- package/dist/predicate/index.js +4 -4
- package/package.json +1 -1
- package/dist/_chunk/{isPrimitive-BBs6Fb.js → isTypedArray-BBEkFl.js} +4 -4
package/dist/compat/index.js
CHANGED
|
@@ -10,7 +10,7 @@ const math_index = require('../math/index.js');
|
|
|
10
10
|
const randomInt = require('../_chunk/randomInt-CF7bZK.js');
|
|
11
11
|
const object_index = require('../object/index.js');
|
|
12
12
|
const predicate_index = require('../predicate/index.js');
|
|
13
|
-
const
|
|
13
|
+
const isTypedArray$1 = require('../_chunk/isTypedArray-BBEkFl.js');
|
|
14
14
|
const string_index = require('../string/index.js');
|
|
15
15
|
|
|
16
16
|
function chunk(arr, size$1 = 1) {
|
|
@@ -266,7 +266,7 @@ function isArray(value) {
|
|
|
266
266
|
}
|
|
267
267
|
|
|
268
268
|
function isTypedArray(x) {
|
|
269
|
-
return
|
|
269
|
+
return isTypedArray$1.isTypedArray(x);
|
|
270
270
|
}
|
|
271
271
|
|
|
272
272
|
function isArrayMatch(target, source) {
|
|
@@ -343,7 +343,7 @@ function isMatch(target, source) {
|
|
|
343
343
|
}
|
|
344
344
|
for (let i = 0; i < keys.length; i++) {
|
|
345
345
|
const key = keys[i];
|
|
346
|
-
if (!
|
|
346
|
+
if (!isTypedArray$1.isPrimitive(target) && !(key in target)) {
|
|
347
347
|
return false;
|
|
348
348
|
}
|
|
349
349
|
if (source[key] === undefined && target[key] !== undefined) {
|
|
@@ -494,7 +494,7 @@ exports.isNotNil = predicate_index.isNotNil;
|
|
|
494
494
|
exports.isNull = predicate_index.isNull;
|
|
495
495
|
exports.isObjectLike = predicate_index.isObjectLike;
|
|
496
496
|
exports.isUndefined = predicate_index.isUndefined;
|
|
497
|
-
exports.isPrimitive =
|
|
497
|
+
exports.isPrimitive = isTypedArray$1.isPrimitive;
|
|
498
498
|
exports.camelCase = string_index.camelCase;
|
|
499
499
|
exports.capitalize = string_index.capitalize;
|
|
500
500
|
exports.kebabCase = string_index.kebabCase;
|
package/dist/index.js
CHANGED
|
@@ -11,7 +11,7 @@ const math_index = require('./math/index.js');
|
|
|
11
11
|
const randomInt = require('./_chunk/randomInt-CF7bZK.js');
|
|
12
12
|
const object_index = require('./object/index.js');
|
|
13
13
|
const predicate_index = require('./predicate/index.js');
|
|
14
|
-
const
|
|
14
|
+
const isTypedArray = require('./_chunk/isTypedArray-BBEkFl.js');
|
|
15
15
|
const string_index = require('./string/index.js');
|
|
16
16
|
|
|
17
17
|
|
|
@@ -109,9 +109,9 @@ exports.isNotNil = predicate_index.isNotNil;
|
|
|
109
109
|
exports.isNull = predicate_index.isNull;
|
|
110
110
|
exports.isObjectLike = predicate_index.isObjectLike;
|
|
111
111
|
exports.isUndefined = predicate_index.isUndefined;
|
|
112
|
-
exports.isPlainObject =
|
|
113
|
-
exports.isPrimitive =
|
|
114
|
-
exports.isTypedArray =
|
|
112
|
+
exports.isPlainObject = isTypedArray.isPlainObject;
|
|
113
|
+
exports.isPrimitive = isTypedArray.isPrimitive;
|
|
114
|
+
exports.isTypedArray = isTypedArray.isTypedArray;
|
|
115
115
|
exports.camelCase = string_index.camelCase;
|
|
116
116
|
exports.capitalize = string_index.capitalize;
|
|
117
117
|
exports.kebabCase = string_index.kebabCase;
|
|
@@ -17,10 +17,10 @@ function cloneDeepImpl(obj, stack = new Map()) {
|
|
|
17
17
|
for (let i = 0; i < obj.length; i++) {
|
|
18
18
|
result[i] = cloneDeepImpl(obj[i], stack);
|
|
19
19
|
}
|
|
20
|
-
if (
|
|
20
|
+
if (Object.prototype.hasOwnProperty.call(obj, 'index')) {
|
|
21
21
|
result.index = obj.index;
|
|
22
22
|
}
|
|
23
|
-
if (
|
|
23
|
+
if (Object.prototype.hasOwnProperty.call(obj, 'input')) {
|
|
24
24
|
result.input = obj.input;
|
|
25
25
|
}
|
|
26
26
|
return result;
|
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 isTypedArray = require('../_chunk/isTypedArray-BBEkFl.js');
|
|
6
6
|
|
|
7
7
|
function omit(obj, keys) {
|
|
8
8
|
const result = { ...obj };
|
|
@@ -101,7 +101,7 @@ function flattenObjectImpl(object, prefix = '') {
|
|
|
101
101
|
const key = keys[i];
|
|
102
102
|
const value = object[key];
|
|
103
103
|
const prefixedKey = prefix ? `${prefix}.${key}` : key;
|
|
104
|
-
if (
|
|
104
|
+
if (isTypedArray.isPlainObject(value) && Object.keys(value).length > 0) {
|
|
105
105
|
Object.assign(result, flattenObjectImpl(value, prefixedKey));
|
|
106
106
|
continue;
|
|
107
107
|
}
|
|
@@ -142,7 +142,7 @@ function cloneDeep(obj) {
|
|
|
142
142
|
return cloneDeepImpl(obj);
|
|
143
143
|
}
|
|
144
144
|
function cloneDeepImpl(obj, stack = new Map()) {
|
|
145
|
-
if (
|
|
145
|
+
if (isTypedArray.isPrimitive(obj)) {
|
|
146
146
|
return obj;
|
|
147
147
|
}
|
|
148
148
|
if (stack.has(obj)) {
|
|
@@ -154,10 +154,10 @@ function cloneDeepImpl(obj, stack = new Map()) {
|
|
|
154
154
|
for (let i = 0; i < obj.length; i++) {
|
|
155
155
|
result[i] = cloneDeepImpl(obj[i], stack);
|
|
156
156
|
}
|
|
157
|
-
if (
|
|
157
|
+
if (Object.prototype.hasOwnProperty.call(obj, 'index')) {
|
|
158
158
|
result.index = obj.index;
|
|
159
159
|
}
|
|
160
|
-
if (
|
|
160
|
+
if (Object.prototype.hasOwnProperty.call(obj, 'input')) {
|
|
161
161
|
result.input = obj.input;
|
|
162
162
|
}
|
|
163
163
|
return result;
|
|
@@ -189,7 +189,7 @@ function cloneDeepImpl(obj, stack = new Map()) {
|
|
|
189
189
|
if (typeof Buffer !== 'undefined' && Buffer.isBuffer(obj)) {
|
|
190
190
|
return obj.subarray();
|
|
191
191
|
}
|
|
192
|
-
if (
|
|
192
|
+
if (isTypedArray.isTypedArray(obj)) {
|
|
193
193
|
const result = new (Object.getPrototypeOf(obj).constructor)(obj.length);
|
|
194
194
|
stack.set(obj, result);
|
|
195
195
|
for (let i = 0; i < obj.length; i++) {
|
package/dist/predicate/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
5
|
const isNil = require('../_chunk/isNil-IuJ4cv.js');
|
|
6
|
-
const
|
|
6
|
+
const isTypedArray = require('../_chunk/isTypedArray-BBEkFl.js');
|
|
7
7
|
|
|
8
8
|
function isEqual(a, b) {
|
|
9
9
|
if (Object.is(a, b)) {
|
|
@@ -78,9 +78,9 @@ function isArguments(value) {
|
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
exports.isNil = isNil.isNil;
|
|
81
|
-
exports.isPlainObject =
|
|
82
|
-
exports.isPrimitive =
|
|
83
|
-
exports.isTypedArray =
|
|
81
|
+
exports.isPlainObject = isTypedArray.isPlainObject;
|
|
82
|
+
exports.isPrimitive = isTypedArray.isPrimitive;
|
|
83
|
+
exports.isTypedArray = isTypedArray.isTypedArray;
|
|
84
84
|
exports.isArguments = isArguments;
|
|
85
85
|
exports.isArrayLike = isArrayLike;
|
|
86
86
|
exports.isEqual = isEqual;
|
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.13.1-dev.
|
|
4
|
+
"version": "1.13.1-dev.367+a4b77c01",
|
|
5
5
|
"homepage": "https://es-toolkit.slash.page",
|
|
6
6
|
"bugs": "https://github.com/toss/es-toolkit/issues",
|
|
7
7
|
"repository": {
|
|
@@ -20,6 +20,10 @@ function isPlainObject(object) {
|
|
|
20
20
|
return Object.getPrototypeOf(object) === proto;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
function isPrimitive(value) {
|
|
24
|
+
return value == null || (typeof value !== 'object' && typeof value !== 'function');
|
|
25
|
+
}
|
|
26
|
+
|
|
23
27
|
function isTypedArray(x) {
|
|
24
28
|
return (x instanceof Uint8Array ||
|
|
25
29
|
x instanceof Uint8ClampedArray ||
|
|
@@ -34,10 +38,6 @@ function isTypedArray(x) {
|
|
|
34
38
|
x instanceof Float64Array);
|
|
35
39
|
}
|
|
36
40
|
|
|
37
|
-
function isPrimitive(value) {
|
|
38
|
-
return value == null || (typeof value !== 'object' && typeof value !== 'function');
|
|
39
|
-
}
|
|
40
|
-
|
|
41
41
|
exports.isPlainObject = isPlainObject;
|
|
42
42
|
exports.isPrimitive = isPrimitive;
|
|
43
43
|
exports.isTypedArray = isTypedArray;
|