es-toolkit 1.13.1-dev.355 → 1.13.1-dev.357

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.
@@ -10,6 +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 isTypedArray$1 = require('../_chunk/isTypedArray-BBEkFl.js');
13
14
  const string_index = require('../string/index.js');
14
15
 
15
16
  function chunk(arr, size = 1) {
@@ -229,7 +230,7 @@ function isArray(value) {
229
230
  }
230
231
 
231
232
  function isTypedArray(x) {
232
- return predicate_index.isTypedArray(x);
233
+ return isTypedArray$1.isTypedArray(x);
233
234
  }
234
235
 
235
236
  function isArrayMatch(target, source) {
@@ -306,7 +307,7 @@ function isMatch(target, source) {
306
307
  }
307
308
  for (let i = 0; i < keys.length; i++) {
308
309
  const key = keys[i];
309
- if (!predicate_index.isPrimitive(target) && !(key in target)) {
310
+ if (!isTypedArray$1.isPrimitive(target) && !(key in target)) {
310
311
  return false;
311
312
  }
312
313
  if (source[key] === undefined && target[key] !== undefined) {
@@ -457,8 +458,8 @@ exports.isNil = predicate_index.isNil;
457
458
  exports.isNotNil = predicate_index.isNotNil;
458
459
  exports.isNull = predicate_index.isNull;
459
460
  exports.isObjectLike = predicate_index.isObjectLike;
460
- exports.isPrimitive = predicate_index.isPrimitive;
461
461
  exports.isUndefined = predicate_index.isUndefined;
462
+ exports.isPrimitive = isTypedArray$1.isPrimitive;
462
463
  exports.camelCase = string_index.camelCase;
463
464
  exports.capitalize = string_index.capitalize;
464
465
  exports.kebabCase = string_index.kebabCase;
package/dist/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 isPlainObject = require('./_chunk/isPlainObject-bK22pA.js');
13
+ const isTypedArray = require('./_chunk/isTypedArray-BBEkFl.js');
14
14
  const string_index = require('./string/index.js');
15
15
 
16
16
 
@@ -106,10 +106,10 @@ exports.isNil = predicate_index.isNil;
106
106
  exports.isNotNil = predicate_index.isNotNil;
107
107
  exports.isNull = predicate_index.isNull;
108
108
  exports.isObjectLike = predicate_index.isObjectLike;
109
- exports.isPrimitive = predicate_index.isPrimitive;
110
- exports.isTypedArray = predicate_index.isTypedArray;
111
109
  exports.isUndefined = predicate_index.isUndefined;
112
- exports.isPlainObject = isPlainObject.isPlainObject;
110
+ exports.isPlainObject = isTypedArray.isPlainObject;
111
+ exports.isPrimitive = isTypedArray.isPrimitive;
112
+ exports.isTypedArray = isTypedArray.isTypedArray;
113
113
  exports.camelCase = string_index.camelCase;
114
114
  exports.capitalize = string_index.capitalize;
115
115
  exports.kebabCase = string_index.kebabCase;
@@ -44,21 +44,6 @@
44
44
  * console.log(clonedObj); // { a: 1, b: { c: 1 } }
45
45
  * console.log(clonedObj === obj); // false
46
46
  */
47
- declare function cloneDeep<T>(obj: T): Resolved<T>;
48
- type Resolved<T> = Equal<T, ResolvedMain<T>> extends true ? T : ResolvedMain<T>;
49
- type Equal<X, Y> = X extends Y ? (Y extends X ? true : false) : false;
50
- type ResolvedMain<T> = T extends [never] ? never : ValueOf<T> extends boolean | number | bigint | string ? ValueOf<T> : T extends (...args: any[]) => any ? never : T extends object ? ResolvedObject<T> : ValueOf<T>;
51
- type ResolvedObject<T extends object> = T extends Array<infer U> ? IsTuple<T> extends true ? ResolvedTuple<T> : Array<ResolvedMain<U>> : T extends Set<infer U> ? Set<ResolvedMain<U>> : T extends Map<infer K, infer V> ? Map<ResolvedMain<K>, ResolvedMain<V>> : T extends WeakSet<any> | WeakMap<any, any> ? never : T extends Date | Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array | BigUint64Array | Int8Array | Int16Array | Int32Array | BigInt64Array | Float32Array | Float64Array | ArrayBuffer | SharedArrayBuffer | DataView | Blob | File ? T : {
52
- [P in keyof T]: ResolvedMain<T[P]>;
53
- };
54
- type ResolvedTuple<T extends readonly any[]> = T extends [] ? [] : T extends [infer F] ? [ResolvedMain<F>] : T extends [infer F, ...infer Rest extends readonly any[]] ? [ResolvedMain<F>, ...ResolvedTuple<Rest>] : T extends [(infer F)?] ? [ResolvedMain<F>?] : T extends [(infer F)?, ...infer Rest extends readonly any[]] ? [ResolvedMain<F>?, ...ResolvedTuple<Rest>] : [];
55
- type IsTuple<T extends readonly any[] | {
56
- length: number;
57
- }> = [T] extends [never] ? false : T extends readonly any[] ? number extends T['length'] ? false : true : false;
58
- type ValueOf<Instance> = IsValueOf<Instance, boolean> extends true ? boolean : IsValueOf<Instance, number> extends true ? number : IsValueOf<Instance, string> extends true ? string : Instance;
59
- type IsValueOf<Instance, O extends IValueOf<any>> = Instance extends O ? O extends IValueOf<infer Primitive> ? Instance extends Primitive ? false : true : false : false;
60
- interface IValueOf<T> {
61
- valueOf(): T;
62
- }
47
+ declare function cloneDeep<T>(obj: T): T;
63
48
 
64
- export { type Resolved, cloneDeep };
49
+ export { cloneDeep };
@@ -44,21 +44,6 @@
44
44
  * console.log(clonedObj); // { a: 1, b: { c: 1 } }
45
45
  * console.log(clonedObj === obj); // false
46
46
  */
47
- declare function cloneDeep<T>(obj: T): Resolved<T>;
48
- type Resolved<T> = Equal<T, ResolvedMain<T>> extends true ? T : ResolvedMain<T>;
49
- type Equal<X, Y> = X extends Y ? (Y extends X ? true : false) : false;
50
- type ResolvedMain<T> = T extends [never] ? never : ValueOf<T> extends boolean | number | bigint | string ? ValueOf<T> : T extends (...args: any[]) => any ? never : T extends object ? ResolvedObject<T> : ValueOf<T>;
51
- type ResolvedObject<T extends object> = T extends Array<infer U> ? IsTuple<T> extends true ? ResolvedTuple<T> : Array<ResolvedMain<U>> : T extends Set<infer U> ? Set<ResolvedMain<U>> : T extends Map<infer K, infer V> ? Map<ResolvedMain<K>, ResolvedMain<V>> : T extends WeakSet<any> | WeakMap<any, any> ? never : T extends Date | Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array | BigUint64Array | Int8Array | Int16Array | Int32Array | BigInt64Array | Float32Array | Float64Array | ArrayBuffer | SharedArrayBuffer | DataView | Blob | File ? T : {
52
- [P in keyof T]: ResolvedMain<T[P]>;
53
- };
54
- type ResolvedTuple<T extends readonly any[]> = T extends [] ? [] : T extends [infer F] ? [ResolvedMain<F>] : T extends [infer F, ...infer Rest extends readonly any[]] ? [ResolvedMain<F>, ...ResolvedTuple<Rest>] : T extends [(infer F)?] ? [ResolvedMain<F>?] : T extends [(infer F)?, ...infer Rest extends readonly any[]] ? [ResolvedMain<F>?, ...ResolvedTuple<Rest>] : [];
55
- type IsTuple<T extends readonly any[] | {
56
- length: number;
57
- }> = [T] extends [never] ? false : T extends readonly any[] ? number extends T['length'] ? false : true : false;
58
- type ValueOf<Instance> = IsValueOf<Instance, boolean> extends true ? boolean : IsValueOf<Instance, number> extends true ? number : IsValueOf<Instance, string> extends true ? string : Instance;
59
- type IsValueOf<Instance, O extends IValueOf<any>> = Instance extends O ? O extends IValueOf<infer Primitive> ? Instance extends Primitive ? false : true : false : false;
60
- interface IValueOf<T> {
61
- valueOf(): T;
62
- }
47
+ declare function cloneDeep<T>(obj: T): T;
63
48
 
64
- export { type Resolved, cloneDeep };
49
+ export { cloneDeep };
@@ -1,34 +1,62 @@
1
+ import { isPrimitive } from '../predicate/isPrimitive.mjs';
2
+ import { isTypedArray } from '../predicate/isTypedArray.mjs';
3
+
1
4
  function cloneDeep(obj) {
5
+ return cloneDeepImpl(obj);
6
+ }
7
+ function cloneDeepImpl(obj, stack = new Map()) {
2
8
  if (isPrimitive(obj)) {
3
9
  return obj;
4
10
  }
11
+ if (stack.has(obj)) {
12
+ return stack.get(obj);
13
+ }
5
14
  if (Array.isArray(obj)) {
6
- return obj.map(item => cloneDeep(item));
15
+ const result = new Array(obj.length);
16
+ stack.set(obj, result);
17
+ for (let i = 0; i < obj.length; i++) {
18
+ result[i] = cloneDeepImpl(obj[i], stack);
19
+ }
20
+ if (obj.hasOwnProperty('index')) {
21
+ result.index = obj.index;
22
+ }
23
+ if (obj.hasOwnProperty('input')) {
24
+ result.input = obj.input;
25
+ }
26
+ return result;
7
27
  }
8
28
  if (obj instanceof Date) {
9
29
  return new Date(obj.getTime());
10
30
  }
11
31
  if (obj instanceof RegExp) {
12
- return new RegExp(obj.source, obj.flags);
32
+ const result = new RegExp(obj.source, obj.flags);
33
+ result.lastIndex = obj.lastIndex;
34
+ return result;
13
35
  }
14
36
  if (obj instanceof Map) {
15
37
  const result = new Map();
38
+ stack.set(obj, result);
16
39
  for (const [key, value] of obj.entries()) {
17
- result.set(key, cloneDeep(value));
40
+ result.set(key, cloneDeepImpl(value, stack));
18
41
  }
19
42
  return result;
20
43
  }
21
44
  if (obj instanceof Set) {
22
45
  const result = new Set();
46
+ stack.set(obj, result);
23
47
  for (const value of obj.values()) {
24
- result.add(cloneDeep(value));
48
+ result.add(cloneDeepImpl(value, stack));
25
49
  }
26
50
  return result;
27
51
  }
52
+ if (typeof Buffer !== 'undefined' && Buffer.isBuffer(obj)) {
53
+ return obj.subarray();
54
+ }
28
55
  if (isTypedArray(obj)) {
29
56
  const result = new (Object.getPrototypeOf(obj).constructor)(obj.length);
57
+ stack.set(obj, result);
30
58
  for (let i = 0; i < obj.length; i++) {
31
- result[i] = cloneDeep(obj[i]);
59
+ result[i] = cloneDeepImpl(obj[i], stack);
32
60
  }
33
61
  return result;
34
62
  }
@@ -37,60 +65,49 @@ function cloneDeep(obj) {
37
65
  }
38
66
  if (obj instanceof DataView) {
39
67
  const result = new DataView(obj.buffer.slice(0));
40
- cloneDeepHelper(obj, result);
68
+ stack.set(obj, result);
69
+ copyProperties(result, obj, stack);
41
70
  return result;
42
71
  }
43
72
  if (typeof File !== 'undefined' && obj instanceof File) {
44
73
  const result = new File([obj], obj.name, { type: obj.type });
45
- cloneDeepHelper(obj, result);
74
+ stack.set(obj, result);
75
+ copyProperties(result, obj, stack);
46
76
  return result;
47
77
  }
48
78
  if (obj instanceof Blob) {
49
79
  const result = new Blob([obj], { type: obj.type });
50
- cloneDeepHelper(obj, result);
80
+ stack.set(obj, result);
81
+ copyProperties(result, obj, stack);
51
82
  return result;
52
83
  }
53
84
  if (obj instanceof Error) {
54
85
  const result = new obj.constructor();
86
+ stack.set(obj, result);
55
87
  result.message = obj.message;
56
88
  result.name = obj.name;
57
89
  result.stack = obj.stack;
58
90
  result.cause = obj.cause;
59
- cloneDeepHelper(obj, result);
91
+ copyProperties(result, obj, stack);
60
92
  return result;
61
93
  }
62
94
  if (typeof obj === 'object' && obj !== null) {
63
95
  const result = {};
64
- cloneDeepHelper(obj, result);
96
+ stack.set(obj, result);
97
+ copyProperties(result, obj, stack);
65
98
  return result;
66
99
  }
67
100
  return obj;
68
101
  }
69
- function isPrimitive(value) {
70
- return value == null || (typeof value !== 'object' && typeof value !== 'function');
71
- }
72
- function cloneDeepHelper(obj, clonedObj) {
73
- const keys = Object.keys(obj);
102
+ function copyProperties(target, source, stack) {
103
+ const keys = Object.keys(source);
74
104
  for (let i = 0; i < keys.length; i++) {
75
105
  const key = keys[i];
76
- const descriptor = Object.getOwnPropertyDescriptor(obj, key);
106
+ const descriptor = Object.getOwnPropertyDescriptor(source, key);
77
107
  if ((descriptor?.writable || descriptor?.set)) {
78
- clonedObj[key] = cloneDeep(obj[key]);
108
+ target[key] = cloneDeepImpl(source[key], stack);
79
109
  }
80
110
  }
81
111
  }
82
- function isTypedArray(obj) {
83
- return (obj instanceof Uint8Array ||
84
- obj instanceof Uint8ClampedArray ||
85
- obj instanceof Uint16Array ||
86
- obj instanceof Uint32Array ||
87
- obj instanceof BigUint64Array ||
88
- obj instanceof Int8Array ||
89
- obj instanceof Int16Array ||
90
- obj instanceof Int32Array ||
91
- obj instanceof BigInt64Array ||
92
- obj instanceof Float32Array ||
93
- obj instanceof Float64Array);
94
- }
95
112
 
96
- export { cloneDeep };
113
+ export { cloneDeep, copyProperties };
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- const isPlainObject = require('../_chunk/isPlainObject-bK22pA.js');
5
+ const isTypedArray = require('../_chunk/isTypedArray-BBEkFl.js');
6
6
 
7
7
  function omit(obj, keys) {
8
8
  const result = { ...obj };
@@ -54,7 +54,7 @@ function invert(obj) {
54
54
  }
55
55
 
56
56
  function clone(obj) {
57
- if (isPrimitive$1(obj)) {
57
+ if (isPrimitive(obj)) {
58
58
  return obj;
59
59
  }
60
60
  if (Array.isArray(obj)) {
@@ -87,7 +87,7 @@ function clone(obj) {
87
87
  }
88
88
  return obj;
89
89
  }
90
- function isPrimitive$1(value) {
90
+ function isPrimitive(value) {
91
91
  return value == null || (typeof value !== 'object' && typeof value !== 'function');
92
92
  }
93
93
 
@@ -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 (isPlainObject.isPlainObject(value) && Object.keys(value).length > 0) {
104
+ if (isTypedArray.isPlainObject(value) && Object.keys(value).length > 0) {
105
105
  Object.assign(result, flattenObjectImpl(value, prefixedKey));
106
106
  continue;
107
107
  }
@@ -139,36 +139,61 @@ function mapValues(object, getNewValue) {
139
139
  }
140
140
 
141
141
  function cloneDeep(obj) {
142
- if (isPrimitive(obj)) {
142
+ return cloneDeepImpl(obj);
143
+ }
144
+ function cloneDeepImpl(obj, stack = new Map()) {
145
+ if (isTypedArray.isPrimitive(obj)) {
143
146
  return obj;
144
147
  }
148
+ if (stack.has(obj)) {
149
+ return stack.get(obj);
150
+ }
145
151
  if (Array.isArray(obj)) {
146
- return obj.map(item => cloneDeep(item));
152
+ const result = new Array(obj.length);
153
+ stack.set(obj, result);
154
+ for (let i = 0; i < obj.length; i++) {
155
+ result[i] = cloneDeepImpl(obj[i], stack);
156
+ }
157
+ if (obj.hasOwnProperty('index')) {
158
+ result.index = obj.index;
159
+ }
160
+ if (obj.hasOwnProperty('input')) {
161
+ result.input = obj.input;
162
+ }
163
+ return result;
147
164
  }
148
165
  if (obj instanceof Date) {
149
166
  return new Date(obj.getTime());
150
167
  }
151
168
  if (obj instanceof RegExp) {
152
- return new RegExp(obj.source, obj.flags);
169
+ const result = new RegExp(obj.source, obj.flags);
170
+ result.lastIndex = obj.lastIndex;
171
+ return result;
153
172
  }
154
173
  if (obj instanceof Map) {
155
174
  const result = new Map();
175
+ stack.set(obj, result);
156
176
  for (const [key, value] of obj.entries()) {
157
- result.set(key, cloneDeep(value));
177
+ result.set(key, cloneDeepImpl(value, stack));
158
178
  }
159
179
  return result;
160
180
  }
161
181
  if (obj instanceof Set) {
162
182
  const result = new Set();
183
+ stack.set(obj, result);
163
184
  for (const value of obj.values()) {
164
- result.add(cloneDeep(value));
185
+ result.add(cloneDeepImpl(value, stack));
165
186
  }
166
187
  return result;
167
188
  }
168
- if (isTypedArray(obj)) {
189
+ if (typeof Buffer !== 'undefined' && Buffer.isBuffer(obj)) {
190
+ return obj.subarray();
191
+ }
192
+ if (isTypedArray.isTypedArray(obj)) {
169
193
  const result = new (Object.getPrototypeOf(obj).constructor)(obj.length);
194
+ stack.set(obj, result);
170
195
  for (let i = 0; i < obj.length; i++) {
171
- result[i] = cloneDeep(obj[i]);
196
+ result[i] = cloneDeepImpl(obj[i], stack);
172
197
  }
173
198
  return result;
174
199
  }
@@ -177,61 +202,50 @@ function cloneDeep(obj) {
177
202
  }
178
203
  if (obj instanceof DataView) {
179
204
  const result = new DataView(obj.buffer.slice(0));
180
- cloneDeepHelper(obj, result);
205
+ stack.set(obj, result);
206
+ copyProperties(result, obj, stack);
181
207
  return result;
182
208
  }
183
209
  if (typeof File !== 'undefined' && obj instanceof File) {
184
210
  const result = new File([obj], obj.name, { type: obj.type });
185
- cloneDeepHelper(obj, result);
211
+ stack.set(obj, result);
212
+ copyProperties(result, obj, stack);
186
213
  return result;
187
214
  }
188
215
  if (obj instanceof Blob) {
189
216
  const result = new Blob([obj], { type: obj.type });
190
- cloneDeepHelper(obj, result);
217
+ stack.set(obj, result);
218
+ copyProperties(result, obj, stack);
191
219
  return result;
192
220
  }
193
221
  if (obj instanceof Error) {
194
222
  const result = new obj.constructor();
223
+ stack.set(obj, result);
195
224
  result.message = obj.message;
196
225
  result.name = obj.name;
197
226
  result.stack = obj.stack;
198
227
  result.cause = obj.cause;
199
- cloneDeepHelper(obj, result);
228
+ copyProperties(result, obj, stack);
200
229
  return result;
201
230
  }
202
231
  if (typeof obj === 'object' && obj !== null) {
203
232
  const result = {};
204
- cloneDeepHelper(obj, result);
233
+ stack.set(obj, result);
234
+ copyProperties(result, obj, stack);
205
235
  return result;
206
236
  }
207
237
  return obj;
208
238
  }
209
- function isPrimitive(value) {
210
- return value == null || (typeof value !== 'object' && typeof value !== 'function');
211
- }
212
- function cloneDeepHelper(obj, clonedObj) {
213
- const keys = Object.keys(obj);
239
+ function copyProperties(target, source, stack) {
240
+ const keys = Object.keys(source);
214
241
  for (let i = 0; i < keys.length; i++) {
215
242
  const key = keys[i];
216
- const descriptor = Object.getOwnPropertyDescriptor(obj, key);
243
+ const descriptor = Object.getOwnPropertyDescriptor(source, key);
217
244
  if ((descriptor?.writable || descriptor?.set)) {
218
- clonedObj[key] = cloneDeep(obj[key]);
245
+ target[key] = cloneDeepImpl(source[key], stack);
219
246
  }
220
247
  }
221
248
  }
222
- function isTypedArray(obj) {
223
- return (obj instanceof Uint8Array ||
224
- obj instanceof Uint8ClampedArray ||
225
- obj instanceof Uint16Array ||
226
- obj instanceof Uint32Array ||
227
- obj instanceof BigUint64Array ||
228
- obj instanceof Int8Array ||
229
- obj instanceof Int16Array ||
230
- obj instanceof Int32Array ||
231
- obj instanceof BigInt64Array ||
232
- obj instanceof Float32Array ||
233
- obj instanceof Float64Array);
234
- }
235
249
 
236
250
  exports.clone = clone;
237
251
  exports.cloneDeep = cloneDeep;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
5
  const union = require('../_chunk/union-CdQeDK.js');
6
- const isPlainObject = require('../_chunk/isPlainObject-bK22pA.js');
6
+ const isTypedArray = require('../_chunk/isTypedArray-BBEkFl.js');
7
7
 
8
8
  function isEqual(a, b) {
9
9
  if (Object.is(a, b)) {
@@ -54,7 +54,7 @@ function isUndefined(x) {
54
54
  }
55
55
 
56
56
  function isLength(value) {
57
- return typeof value === 'number' && value > -1 && value % 1 === 0 && value <= Number.MAX_SAFE_INTEGER;
57
+ return Number.isSafeInteger(value) && value >= 0;
58
58
  }
59
59
 
60
60
  function isFunction(value) {
@@ -66,24 +66,6 @@ function isArrayLike(value) {
66
66
  isLength(value.length);
67
67
  }
68
68
 
69
- function isTypedArray(x) {
70
- return (x instanceof Uint8Array ||
71
- x instanceof Uint8ClampedArray ||
72
- x instanceof Uint16Array ||
73
- x instanceof Uint32Array ||
74
- x instanceof BigUint64Array ||
75
- x instanceof Int8Array ||
76
- x instanceof Int16Array ||
77
- x instanceof Int32Array ||
78
- x instanceof BigInt64Array ||
79
- x instanceof Float32Array ||
80
- x instanceof Float64Array);
81
- }
82
-
83
- function isPrimitive(value) {
84
- return value == null || (typeof value !== 'object' && typeof value !== 'function');
85
- }
86
-
87
69
  function isObjectLike(value) {
88
70
  return typeof value === 'object' && value !== null;
89
71
  }
@@ -99,7 +81,9 @@ function isArguments(value) {
99
81
  return value !== null && typeof value === 'object' && getTag(value) === '[object Arguments]';
100
82
  }
101
83
 
102
- exports.isPlainObject = isPlainObject.isPlainObject;
84
+ exports.isPlainObject = isTypedArray.isPlainObject;
85
+ exports.isPrimitive = isTypedArray.isPrimitive;
86
+ exports.isTypedArray = isTypedArray.isTypedArray;
103
87
  exports.isArguments = isArguments;
104
88
  exports.isArrayLike = isArrayLike;
105
89
  exports.isEqual = isEqual;
@@ -109,6 +93,4 @@ exports.isNil = isNil;
109
93
  exports.isNotNil = isNotNil;
110
94
  exports.isNull = isNull;
111
95
  exports.isObjectLike = isObjectLike;
112
- exports.isPrimitive = isPrimitive;
113
- exports.isTypedArray = isTypedArray;
114
96
  exports.isUndefined = isUndefined;
@@ -1,5 +1,5 @@
1
1
  function isLength(value) {
2
- return typeof value === 'number' && value > -1 && value % 1 === 0 && value <= Number.MAX_SAFE_INTEGER;
2
+ return Number.isSafeInteger(value) && value >= 0;
3
3
  }
4
4
 
5
5
  export { isLength };
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.355+831501ad",
4
+ "version": "1.13.1-dev.357+87693140",
5
5
  "homepage": "https://es-toolkit.slash.page",
6
6
  "bugs": "https://github.com/toss/es-toolkit/issues",
7
7
  "repository": {
@@ -1,23 +0,0 @@
1
- 'use strict';
2
-
3
- function isPlainObject(object) {
4
- if (typeof object !== 'object') {
5
- return false;
6
- }
7
- if (object == null) {
8
- return false;
9
- }
10
- if (Object.getPrototypeOf(object) === null) {
11
- return true;
12
- }
13
- if (object.toString() !== '[object Object]') {
14
- return false;
15
- }
16
- let proto = object;
17
- while (Object.getPrototypeOf(proto) !== null) {
18
- proto = Object.getPrototypeOf(proto);
19
- }
20
- return Object.getPrototypeOf(object) === proto;
21
- }
22
-
23
- exports.isPlainObject = isPlainObject;