es-toolkit 1.36.0 → 1.37.0-dev.1243
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-DINLyA.js +281 -0
- package/dist/_chunk/isPlainObject-Xaozpc.js +93 -0
- package/dist/_chunk/{isPromise-CxqI1v.js → isWeakSet-403Sh5.js} +65 -243
- package/dist/_chunk/{range-HnEIT7.js → range-DSpBDL.js} +0 -21
- package/dist/_chunk/snakeCase-BwvoPi.js +30 -0
- package/dist/_chunk/{unary-EIEhcF.js → unary-DzPndU.js} +0 -39
- package/dist/_chunk/{reverseString-BixeGz.js → upperFirst-C7IztG.js} +9 -52
- package/dist/_chunk/{zip-BJSrRi.js → zip-CIqPLd.js} +0 -102
- package/dist/array/index.js +103 -15
- 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/initial.d.mts +16 -0
- package/dist/compat/array/initial.d.ts +16 -0
- package/dist/compat/array/initial.mjs +11 -0
- package/dist/compat/array/keyBy.d.mts +48 -0
- package/dist/compat/array/keyBy.d.ts +48 -0
- package/dist/compat/array/keyBy.mjs +21 -0
- 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/shuffle.d.mts +22 -0
- package/dist/compat/array/shuffle.d.ts +22 -0
- package/dist/compat/array/shuffle.mjs +24 -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/array/xorBy.d.mts +108 -0
- package/dist/compat/array/xorBy.d.ts +108 -0
- package/dist/compat/array/xorBy.mjs +23 -0
- package/dist/compat/array/xorWith.d.mts +89 -0
- package/dist/compat/array/xorWith.d.ts +89 -0
- package/dist/compat/array/xorWith.mjs +21 -0
- package/dist/compat/compat.d.mts +25 -58
- package/dist/compat/compat.d.ts +25 -58
- package/dist/compat/compat.mjs +28 -63
- package/dist/compat/function/wrap.d.mts +27 -0
- package/dist/compat/function/wrap.d.ts +27 -0
- package/dist/compat/function/wrap.mjs +11 -0
- package/dist/compat/index.d.mts +25 -58
- package/dist/compat/index.d.ts +25 -58
- package/dist/compat/index.js +4688 -327
- package/dist/compat/index.mjs +28 -63
- 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/function/index.js +39 -3
- package/dist/index.js +93 -92
- package/dist/math/index.js +22 -3
- package/dist/object/index.js +122 -15
- package/dist/object/toCamelCaseKeys.mjs +2 -12
- package/dist/object/toSnakeCaseKeys.mjs +1 -11
- package/dist/predicate/index.js +113 -30
- package/dist/string/index.js +37 -22
- package/dist/util/index.js +19 -4
- package/package.json +1 -1
- package/dist/_chunk/invariant-BfGFfr.js +0 -21
- package/dist/_chunk/toSnakeCaseKeys-DZO2eB.js +0 -4901
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
# es-toolkit Changelog
|
|
2
|
+
|
|
3
|
+
## Version v1.37.0
|
|
4
|
+
|
|
5
|
+
Released on May 3rd, 2025.
|
|
6
|
+
|
|
7
|
+
- Introduced compatibility functions for [result](https://es-toolkit.slash.page/reference/compat/object/result.html), [omitBy](https://es-toolkit.slash.page/reference/object/omitBy.html), [xorBy](https://es-toolkit.slash.page/reference/array/xorBy.html), [xorWith](https://es-toolkit.slash.page/reference/array/xorWith.html), [unzipWith](https://es-toolkit.slash.page/reference/array/unzipWith.html), [sampleSize](https://es-toolkit.slash.page/reference/array/sampleSize.html), [transform](https://es-toolkit.slash.page/reference/compat/object/transform.html), [wrap](https://es-toolkit.slash.page/reference/compat/function/wrap.html), [countBy](https://es-toolkit.slash.page/reference/array/countBy.html), and [xor](https://es-toolkit.slash.page/reference/array/xor.html).
|
|
8
|
+
- Added vitest benchmark for [ary](https://es-toolkit.slash.page/reference/function/ary.html) function.
|
|
9
|
+
- Fixed string comparison in [sortBy](https://es-toolkit.slash.page/reference/array/sortBy.html) and [orderBy](https://es-toolkit.slash.page/reference/array/orderBy.html) by removing locale comparison and using ASCII code instead.
|
|
10
|
+
- Fixed type definition in [isBuffer](https://es-toolkit.slash.page/reference/predicate/isBuffer.html).
|
|
11
|
+
- Fixed internal documentation links for Korean and Japanese headings.
|
|
12
|
+
- Improved code readability and documentation for various functions.
|
|
13
|
+
- Prevented circular dependencies by updating import paths in [toCamelCaseKeys](https://es-toolkit.slash.page/reference/object/toCamelCaseKeys.html) and [toSnakeCaseKeys](https://es-toolkit.slash.page/reference/object/toSnakeCaseKeys.html).
|
|
14
|
+
|
|
15
|
+
We sincerely thank @chldmsqls34, @umsungjun, @raon0211, @dayongkr, @shren207, @oror-sine, @L2HYUNN, @D-Sketon, @ariandel-dev, @Jeong-Rae, and @beomxtone for their contributions. We appreciate your great efforts!
|
|
16
|
+
|
|
2
17
|
## Version v1.36.0
|
|
3
18
|
|
|
4
19
|
Released on April 24th, 2025.
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const isPlainObject$1 = require('./isPlainObject-Xaozpc.js');
|
|
4
|
+
|
|
5
|
+
function clone(obj) {
|
|
6
|
+
if (isPlainObject$1.isPrimitive(obj)) {
|
|
7
|
+
return obj;
|
|
8
|
+
}
|
|
9
|
+
if (Array.isArray(obj) ||
|
|
10
|
+
isPlainObject$1.isTypedArray(obj) ||
|
|
11
|
+
obj instanceof ArrayBuffer ||
|
|
12
|
+
(typeof SharedArrayBuffer !== 'undefined' && obj instanceof SharedArrayBuffer)) {
|
|
13
|
+
return obj.slice(0);
|
|
14
|
+
}
|
|
15
|
+
const prototype = Object.getPrototypeOf(obj);
|
|
16
|
+
const Constructor = prototype.constructor;
|
|
17
|
+
if (obj instanceof Date || obj instanceof Map || obj instanceof Set) {
|
|
18
|
+
return new Constructor(obj);
|
|
19
|
+
}
|
|
20
|
+
if (obj instanceof RegExp) {
|
|
21
|
+
const newRegExp = new Constructor(obj);
|
|
22
|
+
newRegExp.lastIndex = obj.lastIndex;
|
|
23
|
+
return newRegExp;
|
|
24
|
+
}
|
|
25
|
+
if (obj instanceof DataView) {
|
|
26
|
+
return new Constructor(obj.buffer.slice(0));
|
|
27
|
+
}
|
|
28
|
+
if (obj instanceof Error) {
|
|
29
|
+
const newError = new Constructor(obj.message);
|
|
30
|
+
newError.stack = obj.stack;
|
|
31
|
+
newError.name = obj.name;
|
|
32
|
+
newError.cause = obj.cause;
|
|
33
|
+
return newError;
|
|
34
|
+
}
|
|
35
|
+
if (typeof File !== 'undefined' && obj instanceof File) {
|
|
36
|
+
const newFile = new Constructor([obj], obj.name, { type: obj.type, lastModified: obj.lastModified });
|
|
37
|
+
return newFile;
|
|
38
|
+
}
|
|
39
|
+
if (typeof obj === 'object') {
|
|
40
|
+
const newObject = Object.create(prototype);
|
|
41
|
+
return Object.assign(newObject, obj);
|
|
42
|
+
}
|
|
43
|
+
return obj;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function cloneDeepWith(obj, cloneValue) {
|
|
47
|
+
return cloneDeepWithImpl(obj, undefined, obj, new Map(), cloneValue);
|
|
48
|
+
}
|
|
49
|
+
function cloneDeepWithImpl(valueToClone, keyToClone, objectToClone, stack = new Map(), cloneValue = undefined) {
|
|
50
|
+
const cloned = cloneValue?.(valueToClone, keyToClone, objectToClone, stack);
|
|
51
|
+
if (cloned != null) {
|
|
52
|
+
return cloned;
|
|
53
|
+
}
|
|
54
|
+
if (isPlainObject$1.isPrimitive(valueToClone)) {
|
|
55
|
+
return valueToClone;
|
|
56
|
+
}
|
|
57
|
+
if (stack.has(valueToClone)) {
|
|
58
|
+
return stack.get(valueToClone);
|
|
59
|
+
}
|
|
60
|
+
if (Array.isArray(valueToClone)) {
|
|
61
|
+
const result = new Array(valueToClone.length);
|
|
62
|
+
stack.set(valueToClone, result);
|
|
63
|
+
for (let i = 0; i < valueToClone.length; i++) {
|
|
64
|
+
result[i] = cloneDeepWithImpl(valueToClone[i], i, objectToClone, stack, cloneValue);
|
|
65
|
+
}
|
|
66
|
+
if (Object.hasOwn(valueToClone, 'index')) {
|
|
67
|
+
result.index = valueToClone.index;
|
|
68
|
+
}
|
|
69
|
+
if (Object.hasOwn(valueToClone, 'input')) {
|
|
70
|
+
result.input = valueToClone.input;
|
|
71
|
+
}
|
|
72
|
+
return result;
|
|
73
|
+
}
|
|
74
|
+
if (valueToClone instanceof Date) {
|
|
75
|
+
return new Date(valueToClone.getTime());
|
|
76
|
+
}
|
|
77
|
+
if (valueToClone instanceof RegExp) {
|
|
78
|
+
const result = new RegExp(valueToClone.source, valueToClone.flags);
|
|
79
|
+
result.lastIndex = valueToClone.lastIndex;
|
|
80
|
+
return result;
|
|
81
|
+
}
|
|
82
|
+
if (valueToClone instanceof Map) {
|
|
83
|
+
const result = new Map();
|
|
84
|
+
stack.set(valueToClone, result);
|
|
85
|
+
for (const [key, value] of valueToClone) {
|
|
86
|
+
result.set(key, cloneDeepWithImpl(value, key, objectToClone, stack, cloneValue));
|
|
87
|
+
}
|
|
88
|
+
return result;
|
|
89
|
+
}
|
|
90
|
+
if (valueToClone instanceof Set) {
|
|
91
|
+
const result = new Set();
|
|
92
|
+
stack.set(valueToClone, result);
|
|
93
|
+
for (const value of valueToClone) {
|
|
94
|
+
result.add(cloneDeepWithImpl(value, undefined, objectToClone, stack, cloneValue));
|
|
95
|
+
}
|
|
96
|
+
return result;
|
|
97
|
+
}
|
|
98
|
+
if (typeof Buffer !== 'undefined' && Buffer.isBuffer(valueToClone)) {
|
|
99
|
+
return valueToClone.subarray();
|
|
100
|
+
}
|
|
101
|
+
if (isPlainObject$1.isTypedArray(valueToClone)) {
|
|
102
|
+
const result = new (Object.getPrototypeOf(valueToClone).constructor)(valueToClone.length);
|
|
103
|
+
stack.set(valueToClone, result);
|
|
104
|
+
for (let i = 0; i < valueToClone.length; i++) {
|
|
105
|
+
result[i] = cloneDeepWithImpl(valueToClone[i], i, objectToClone, stack, cloneValue);
|
|
106
|
+
}
|
|
107
|
+
return result;
|
|
108
|
+
}
|
|
109
|
+
if (valueToClone instanceof ArrayBuffer ||
|
|
110
|
+
(typeof SharedArrayBuffer !== 'undefined' && valueToClone instanceof SharedArrayBuffer)) {
|
|
111
|
+
return valueToClone.slice(0);
|
|
112
|
+
}
|
|
113
|
+
if (valueToClone instanceof DataView) {
|
|
114
|
+
const result = new DataView(valueToClone.buffer.slice(0), valueToClone.byteOffset, valueToClone.byteLength);
|
|
115
|
+
stack.set(valueToClone, result);
|
|
116
|
+
copyProperties(result, valueToClone, objectToClone, stack, cloneValue);
|
|
117
|
+
return result;
|
|
118
|
+
}
|
|
119
|
+
if (typeof File !== 'undefined' && valueToClone instanceof File) {
|
|
120
|
+
const result = new File([valueToClone], valueToClone.name, {
|
|
121
|
+
type: valueToClone.type,
|
|
122
|
+
});
|
|
123
|
+
stack.set(valueToClone, result);
|
|
124
|
+
copyProperties(result, valueToClone, objectToClone, stack, cloneValue);
|
|
125
|
+
return result;
|
|
126
|
+
}
|
|
127
|
+
if (valueToClone instanceof Blob) {
|
|
128
|
+
const result = new Blob([valueToClone], { type: valueToClone.type });
|
|
129
|
+
stack.set(valueToClone, result);
|
|
130
|
+
copyProperties(result, valueToClone, objectToClone, stack, cloneValue);
|
|
131
|
+
return result;
|
|
132
|
+
}
|
|
133
|
+
if (valueToClone instanceof Error) {
|
|
134
|
+
const result = new valueToClone.constructor();
|
|
135
|
+
stack.set(valueToClone, result);
|
|
136
|
+
result.message = valueToClone.message;
|
|
137
|
+
result.name = valueToClone.name;
|
|
138
|
+
result.stack = valueToClone.stack;
|
|
139
|
+
result.cause = valueToClone.cause;
|
|
140
|
+
copyProperties(result, valueToClone, objectToClone, stack, cloneValue);
|
|
141
|
+
return result;
|
|
142
|
+
}
|
|
143
|
+
if (typeof valueToClone === 'object' && isCloneableObject(valueToClone)) {
|
|
144
|
+
const result = Object.create(Object.getPrototypeOf(valueToClone));
|
|
145
|
+
stack.set(valueToClone, result);
|
|
146
|
+
copyProperties(result, valueToClone, objectToClone, stack, cloneValue);
|
|
147
|
+
return result;
|
|
148
|
+
}
|
|
149
|
+
return valueToClone;
|
|
150
|
+
}
|
|
151
|
+
function copyProperties(target, source, objectToClone = target, stack, cloneValue) {
|
|
152
|
+
const keys = [...Object.keys(source), ...isPlainObject$1.getSymbols(source)];
|
|
153
|
+
for (let i = 0; i < keys.length; i++) {
|
|
154
|
+
const key = keys[i];
|
|
155
|
+
const descriptor = Object.getOwnPropertyDescriptor(target, key);
|
|
156
|
+
if (descriptor == null || descriptor.writable) {
|
|
157
|
+
target[key] = cloneDeepWithImpl(source[key], key, objectToClone, stack, cloneValue);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
function isCloneableObject(object) {
|
|
162
|
+
switch (isPlainObject$1.getTag(object)) {
|
|
163
|
+
case isPlainObject$1.argumentsTag:
|
|
164
|
+
case isPlainObject$1.arrayTag:
|
|
165
|
+
case isPlainObject$1.arrayBufferTag:
|
|
166
|
+
case isPlainObject$1.dataViewTag:
|
|
167
|
+
case isPlainObject$1.booleanTag:
|
|
168
|
+
case isPlainObject$1.dateTag:
|
|
169
|
+
case isPlainObject$1.float32ArrayTag:
|
|
170
|
+
case isPlainObject$1.float64ArrayTag:
|
|
171
|
+
case isPlainObject$1.int8ArrayTag:
|
|
172
|
+
case isPlainObject$1.int16ArrayTag:
|
|
173
|
+
case isPlainObject$1.int32ArrayTag:
|
|
174
|
+
case isPlainObject$1.mapTag:
|
|
175
|
+
case isPlainObject$1.numberTag:
|
|
176
|
+
case isPlainObject$1.objectTag:
|
|
177
|
+
case isPlainObject$1.regexpTag:
|
|
178
|
+
case isPlainObject$1.setTag:
|
|
179
|
+
case isPlainObject$1.stringTag:
|
|
180
|
+
case isPlainObject$1.symbolTag:
|
|
181
|
+
case isPlainObject$1.uint8ArrayTag:
|
|
182
|
+
case isPlainObject$1.uint8ClampedArrayTag:
|
|
183
|
+
case isPlainObject$1.uint16ArrayTag:
|
|
184
|
+
case isPlainObject$1.uint32ArrayTag: {
|
|
185
|
+
return true;
|
|
186
|
+
}
|
|
187
|
+
default: {
|
|
188
|
+
return false;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
function cloneDeep(obj) {
|
|
194
|
+
return cloneDeepWithImpl(obj, undefined, obj, new Map(), undefined);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function findKey(obj, predicate) {
|
|
198
|
+
const keys = Object.keys(obj);
|
|
199
|
+
return keys.find(key => predicate(obj[key], key, obj));
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
function invert(obj) {
|
|
203
|
+
const result = {};
|
|
204
|
+
const keys = Object.keys(obj);
|
|
205
|
+
for (let i = 0; i < keys.length; i++) {
|
|
206
|
+
const key = keys[i];
|
|
207
|
+
const value = obj[key];
|
|
208
|
+
result[value] = key;
|
|
209
|
+
}
|
|
210
|
+
return result;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
function mapKeys(object, getNewKey) {
|
|
214
|
+
const result = {};
|
|
215
|
+
const keys = Object.keys(object);
|
|
216
|
+
for (let i = 0; i < keys.length; i++) {
|
|
217
|
+
const key = keys[i];
|
|
218
|
+
const value = object[key];
|
|
219
|
+
result[getNewKey(value, key, object)] = value;
|
|
220
|
+
}
|
|
221
|
+
return result;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
function mapValues(object, getNewValue) {
|
|
225
|
+
const result = {};
|
|
226
|
+
const keys = Object.keys(object);
|
|
227
|
+
for (let i = 0; i < keys.length; i++) {
|
|
228
|
+
const key = keys[i];
|
|
229
|
+
const value = object[key];
|
|
230
|
+
result[key] = getNewValue(value, key, object);
|
|
231
|
+
}
|
|
232
|
+
return result;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
function isObjectLike(value) {
|
|
236
|
+
return typeof value === 'object' && value !== null;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
function isArray(value) {
|
|
240
|
+
return Array.isArray(value);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
function isPlainObject(object) {
|
|
244
|
+
if (typeof object !== 'object') {
|
|
245
|
+
return false;
|
|
246
|
+
}
|
|
247
|
+
if (object == null) {
|
|
248
|
+
return false;
|
|
249
|
+
}
|
|
250
|
+
if (Object.getPrototypeOf(object) === null) {
|
|
251
|
+
return true;
|
|
252
|
+
}
|
|
253
|
+
if (Object.prototype.toString.call(object) !== '[object Object]') {
|
|
254
|
+
const tag = object[Symbol.toStringTag];
|
|
255
|
+
if (tag == null) {
|
|
256
|
+
return false;
|
|
257
|
+
}
|
|
258
|
+
const isTagReadonly = !Object.getOwnPropertyDescriptor(object, Symbol.toStringTag)?.writable;
|
|
259
|
+
if (isTagReadonly) {
|
|
260
|
+
return false;
|
|
261
|
+
}
|
|
262
|
+
return object.toString() === `[object ${tag}]`;
|
|
263
|
+
}
|
|
264
|
+
let proto = object;
|
|
265
|
+
while (Object.getPrototypeOf(proto) !== null) {
|
|
266
|
+
proto = Object.getPrototypeOf(proto);
|
|
267
|
+
}
|
|
268
|
+
return Object.getPrototypeOf(object) === proto;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
exports.clone = clone;
|
|
272
|
+
exports.cloneDeep = cloneDeep;
|
|
273
|
+
exports.cloneDeepWith = cloneDeepWith;
|
|
274
|
+
exports.copyProperties = copyProperties;
|
|
275
|
+
exports.findKey = findKey;
|
|
276
|
+
exports.invert = invert;
|
|
277
|
+
exports.isArray = isArray;
|
|
278
|
+
exports.isObjectLike = isObjectLike;
|
|
279
|
+
exports.isPlainObject = isPlainObject;
|
|
280
|
+
exports.mapKeys = mapKeys;
|
|
281
|
+
exports.mapValues = mapValues;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function isPrimitive(value) {
|
|
4
|
+
return value == null || (typeof value !== 'object' && typeof value !== 'function');
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
function isTypedArray(x) {
|
|
8
|
+
return ArrayBuffer.isView(x) && !(x instanceof DataView);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function getSymbols(object) {
|
|
12
|
+
return Object.getOwnPropertySymbols(object).filter(symbol => Object.prototype.propertyIsEnumerable.call(object, symbol));
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function getTag(value) {
|
|
16
|
+
if (value == null) {
|
|
17
|
+
return value === undefined ? '[object Undefined]' : '[object Null]';
|
|
18
|
+
}
|
|
19
|
+
return Object.prototype.toString.call(value);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const regexpTag = '[object RegExp]';
|
|
23
|
+
const stringTag = '[object String]';
|
|
24
|
+
const numberTag = '[object Number]';
|
|
25
|
+
const booleanTag = '[object Boolean]';
|
|
26
|
+
const argumentsTag = '[object Arguments]';
|
|
27
|
+
const symbolTag = '[object Symbol]';
|
|
28
|
+
const dateTag = '[object Date]';
|
|
29
|
+
const mapTag = '[object Map]';
|
|
30
|
+
const setTag = '[object Set]';
|
|
31
|
+
const arrayTag = '[object Array]';
|
|
32
|
+
const functionTag = '[object Function]';
|
|
33
|
+
const arrayBufferTag = '[object ArrayBuffer]';
|
|
34
|
+
const objectTag = '[object Object]';
|
|
35
|
+
const errorTag = '[object Error]';
|
|
36
|
+
const dataViewTag = '[object DataView]';
|
|
37
|
+
const uint8ArrayTag = '[object Uint8Array]';
|
|
38
|
+
const uint8ClampedArrayTag = '[object Uint8ClampedArray]';
|
|
39
|
+
const uint16ArrayTag = '[object Uint16Array]';
|
|
40
|
+
const uint32ArrayTag = '[object Uint32Array]';
|
|
41
|
+
const bigUint64ArrayTag = '[object BigUint64Array]';
|
|
42
|
+
const int8ArrayTag = '[object Int8Array]';
|
|
43
|
+
const int16ArrayTag = '[object Int16Array]';
|
|
44
|
+
const int32ArrayTag = '[object Int32Array]';
|
|
45
|
+
const bigInt64ArrayTag = '[object BigInt64Array]';
|
|
46
|
+
const float32ArrayTag = '[object Float32Array]';
|
|
47
|
+
const float64ArrayTag = '[object Float64Array]';
|
|
48
|
+
|
|
49
|
+
function isPlainObject(value) {
|
|
50
|
+
if (!value || typeof value !== 'object') {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
const proto = Object.getPrototypeOf(value);
|
|
54
|
+
const hasObjectPrototype = proto === null ||
|
|
55
|
+
proto === Object.prototype ||
|
|
56
|
+
Object.getPrototypeOf(proto) === null;
|
|
57
|
+
if (!hasObjectPrototype) {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
return Object.prototype.toString.call(value) === '[object Object]';
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
exports.argumentsTag = argumentsTag;
|
|
64
|
+
exports.arrayBufferTag = arrayBufferTag;
|
|
65
|
+
exports.arrayTag = arrayTag;
|
|
66
|
+
exports.bigInt64ArrayTag = bigInt64ArrayTag;
|
|
67
|
+
exports.bigUint64ArrayTag = bigUint64ArrayTag;
|
|
68
|
+
exports.booleanTag = booleanTag;
|
|
69
|
+
exports.dataViewTag = dataViewTag;
|
|
70
|
+
exports.dateTag = dateTag;
|
|
71
|
+
exports.errorTag = errorTag;
|
|
72
|
+
exports.float32ArrayTag = float32ArrayTag;
|
|
73
|
+
exports.float64ArrayTag = float64ArrayTag;
|
|
74
|
+
exports.functionTag = functionTag;
|
|
75
|
+
exports.getSymbols = getSymbols;
|
|
76
|
+
exports.getTag = getTag;
|
|
77
|
+
exports.int16ArrayTag = int16ArrayTag;
|
|
78
|
+
exports.int32ArrayTag = int32ArrayTag;
|
|
79
|
+
exports.int8ArrayTag = int8ArrayTag;
|
|
80
|
+
exports.isPlainObject = isPlainObject;
|
|
81
|
+
exports.isPrimitive = isPrimitive;
|
|
82
|
+
exports.isTypedArray = isTypedArray;
|
|
83
|
+
exports.mapTag = mapTag;
|
|
84
|
+
exports.numberTag = numberTag;
|
|
85
|
+
exports.objectTag = objectTag;
|
|
86
|
+
exports.regexpTag = regexpTag;
|
|
87
|
+
exports.setTag = setTag;
|
|
88
|
+
exports.stringTag = stringTag;
|
|
89
|
+
exports.symbolTag = symbolTag;
|
|
90
|
+
exports.uint16ArrayTag = uint16ArrayTag;
|
|
91
|
+
exports.uint32ArrayTag = uint32ArrayTag;
|
|
92
|
+
exports.uint8ArrayTag = uint8ArrayTag;
|
|
93
|
+
exports.uint8ClampedArrayTag = uint8ClampedArrayTag;
|