ut2 1.4.9 → 1.5.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/README.md +4 -4
- package/dist/ut2.js +52 -53
- package/dist/ut2.js.map +1 -1
- package/dist/ut2.min.js +1 -1
- package/dist/ut2.min.js.map +1 -1
- package/es/internals/getSymbols.js +2 -2
- package/es/internals/getTag.js +8 -8
- package/es/internals/getTagWithBugfix.js +6 -6
- package/es/internals/helpers.js +4 -4
- package/es/internals/keys.js +2 -2
- package/es/internals/native.js +9 -8
- package/es/internals/nodeUtil.js +0 -5
- package/es/internals/root.js +2 -1
- package/es/isArguments.js +3 -3
- package/es/isArrayBuffer.js +2 -2
- package/es/isBlob.js +2 -2
- package/es/isBoolean.js +2 -2
- package/es/isDate.js +2 -2
- package/es/isEqual.js +3 -3
- package/es/isError.js +2 -2
- package/es/isFunction.js +2 -2
- package/es/isMatch.js +2 -2
- package/es/isNumber.js +2 -2
- package/es/isPlainObject.js +4 -4
- package/es/isRegExp.js +2 -2
- package/es/isString.js +2 -2
- package/es/isSymbol.js +2 -2
- package/es/isTypedArray.js +2 -2
- package/es/isWeakSet.js +2 -2
- package/es/nth.js +3 -3
- package/lib/internals/getSymbols.js +1 -1
- package/lib/internals/getTag.js +7 -7
- package/lib/internals/getTagWithBugfix.js +5 -5
- package/lib/internals/helpers.js +3 -3
- package/lib/internals/keys.js +1 -1
- package/lib/internals/native.js +8 -7
- package/lib/internals/nodeUtil.js +0 -5
- package/lib/internals/root.js +2 -1
- package/lib/isArguments.js +2 -2
- package/lib/isArrayBuffer.js +1 -1
- package/lib/isBlob.js +1 -1
- package/lib/isBoolean.js +1 -1
- package/lib/isDate.js +1 -1
- package/lib/isEqual.js +2 -2
- package/lib/isError.js +1 -1
- package/lib/isFunction.js +1 -1
- package/lib/isMatch.js +1 -1
- package/lib/isNumber.js +1 -1
- package/lib/isPlainObject.js +3 -3
- package/lib/isRegExp.js +1 -1
- package/lib/isString.js +1 -1
- package/lib/isSymbol.js +1 -1
- package/lib/isTypedArray.js +1 -1
- package/lib/isWeakSet.js +1 -1
- package/lib/nth.js +2 -2
- package/package.json +8 -7
- package/types/internals/native.d.ts +8 -7
package/es/internals/getTag.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { symbolToStringTag, objectProtoToString, objectProtoHasOwnProperty } from './native.js';
|
|
2
2
|
|
|
3
3
|
function getRawTag(value) {
|
|
4
|
-
var isOwn =
|
|
5
|
-
var tag = value[
|
|
4
|
+
var isOwn = objectProtoHasOwnProperty.call(value, symbolToStringTag);
|
|
5
|
+
var tag = value[symbolToStringTag];
|
|
6
6
|
var unmasked = false;
|
|
7
7
|
try {
|
|
8
|
-
value[
|
|
8
|
+
value[symbolToStringTag] = undefined;
|
|
9
9
|
unmasked = true;
|
|
10
10
|
}
|
|
11
11
|
catch (e) {
|
|
12
12
|
}
|
|
13
|
-
var result =
|
|
13
|
+
var result = objectProtoToString.call(value);
|
|
14
14
|
if (unmasked) {
|
|
15
15
|
if (isOwn) {
|
|
16
|
-
value[
|
|
16
|
+
value[symbolToStringTag] = tag;
|
|
17
17
|
}
|
|
18
18
|
else {
|
|
19
|
-
delete value[
|
|
19
|
+
delete value[symbolToStringTag];
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
return result;
|
|
23
23
|
}
|
|
24
24
|
function getTag(value) {
|
|
25
|
-
return
|
|
25
|
+
return symbolToStringTag && symbolToStringTag in Object(value) ? getRawTag(value) : objectProtoToString.call(value);
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
export { getTag as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { objectProtoToString, dataViewTag, mapTag, promiseTag, setTag, weakMapTag, objectTag } from './native.js';
|
|
2
2
|
import { toSource } from './helpers.js';
|
|
3
3
|
import getTag from './getTag.js';
|
|
4
4
|
|
|
@@ -13,11 +13,11 @@ var promiseCtorString = toSource(Promise);
|
|
|
13
13
|
var setCtorString = toSource(Set);
|
|
14
14
|
var weakMapCtorString = toSource(WeakMap);
|
|
15
15
|
var getTagWithBugfix = getTag;
|
|
16
|
-
if ((dataViewExisted &&
|
|
17
|
-
(mapExisted &&
|
|
18
|
-
(promiseExisted &&
|
|
19
|
-
(setExisted &&
|
|
20
|
-
(weakMapExisted &&
|
|
16
|
+
if ((dataViewExisted && objectProtoToString.call(new DataView(new ArrayBuffer(1))) !== dataViewTag) ||
|
|
17
|
+
(mapExisted && objectProtoToString.call(new Map()) !== mapTag) ||
|
|
18
|
+
(promiseExisted && objectProtoToString.call(Promise.resolve()) !== promiseTag) ||
|
|
19
|
+
(setExisted && objectProtoToString.call(new Set()) !== setTag) ||
|
|
20
|
+
(weakMapExisted && objectProtoToString.call(new WeakMap()) !== weakMapTag)) {
|
|
21
21
|
getTagWithBugfix = function (value) {
|
|
22
22
|
var result = getTag(value);
|
|
23
23
|
var Ctor = result === objectTag ? value.constructor : undefined;
|
package/es/internals/helpers.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { objectProtoToString, argumentsTag, functionProtoToString } from './native.js';
|
|
2
2
|
|
|
3
|
-
var VERSION = "1.
|
|
4
|
-
var supportedArgumentsType =
|
|
3
|
+
var VERSION = "1.5.0";
|
|
4
|
+
var supportedArgumentsType = objectProtoToString.call((function () { return arguments; })()) === argumentsTag;
|
|
5
5
|
var FUNC_ERROR_TEXT = 'Expected a function';
|
|
6
6
|
function toSource(func) {
|
|
7
7
|
if (func !== null) {
|
|
8
8
|
try {
|
|
9
|
-
return
|
|
9
|
+
return functionProtoToString.call(func);
|
|
10
10
|
}
|
|
11
11
|
catch (e) {
|
|
12
12
|
}
|
package/es/internals/keys.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import isPrototype from './isPrototype.js';
|
|
2
|
-
import { objectKeys,
|
|
2
|
+
import { objectKeys, objectProtoHasOwnProperty } from './native.js';
|
|
3
3
|
|
|
4
4
|
function keys(value) {
|
|
5
5
|
if (!isPrototype(value)) {
|
|
@@ -7,7 +7,7 @@ function keys(value) {
|
|
|
7
7
|
}
|
|
8
8
|
var result = [];
|
|
9
9
|
for (var key in Object(value)) {
|
|
10
|
-
if (
|
|
10
|
+
if (objectProtoHasOwnProperty.call(value, key) && key !== 'constructor') {
|
|
11
11
|
result.push(key);
|
|
12
12
|
}
|
|
13
13
|
}
|
package/es/internals/native.js
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
var objectProto = Object.prototype;
|
|
2
|
-
var
|
|
2
|
+
var objectProtoToString = objectProto.toString;
|
|
3
|
+
var objectProtoHasOwnProperty = objectProto.hasOwnProperty;
|
|
4
|
+
var objectProtoPropertyIsEnumerable = objectProto.propertyIsEnumerable;
|
|
3
5
|
var objectGetOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
4
6
|
var objectGetPrototypeOf = Object.getPrototypeOf;
|
|
5
7
|
var objectKeys = Object.keys;
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var functionToString = Function.prototype.toString;
|
|
8
|
+
var functionProto = Function.prototype;
|
|
9
|
+
var functionProtoToString = functionProto.toString;
|
|
9
10
|
var symbolExisted = typeof Symbol !== 'undefined';
|
|
10
11
|
var symbolProto = symbolExisted ? Symbol.prototype : undefined;
|
|
11
|
-
var
|
|
12
|
+
var symbolToStringTag = symbolExisted ? Symbol.toStringTag : undefined;
|
|
12
13
|
var arrayProto = Array.prototype;
|
|
13
|
-
var
|
|
14
|
-
var
|
|
14
|
+
var arrayProtoSlice = arrayProto.slice;
|
|
15
|
+
var arrayProtoAt = arrayProto.at;
|
|
15
16
|
var numberIsFinite = Number.isFinite;
|
|
16
17
|
var numberIsInteger = Number.isInteger;
|
|
17
18
|
var numberIsSafeInteger = Number.isSafeInteger;
|
|
@@ -40,4 +41,4 @@ var promiseTag = '[object Promise]';
|
|
|
40
41
|
var setTag = '[object Set]';
|
|
41
42
|
var weakMapTag = '[object WeakMap]';
|
|
42
43
|
|
|
43
|
-
export { MAX_ARRAY_LENGTH, MAX_SAFE_INTEGER, MIN_SAFE_INTEGER, argumentsTag,
|
|
44
|
+
export { MAX_ARRAY_LENGTH, MAX_SAFE_INTEGER, MIN_SAFE_INTEGER, argumentsTag, arrayBufferTag, arrayProto, arrayProtoAt, arrayProtoSlice, arrayTag, blobTag, booleanTag, dataViewTag, dateTag, domExceptionTag, errorTag, functionProto, functionProtoToString, functionTags, mapTag, numberIsFinite, numberIsInteger, numberIsSafeInteger, numberTag, objectGetOwnPropertySymbols, objectGetPrototypeOf, objectKeys, objectProto, objectProtoHasOwnProperty, objectProtoPropertyIsEnumerable, objectProtoToString, objectTag, promiseTag, regExpTag, setTag, stringTag, symbolProto, symbolTag, symbolToStringTag, typedArrayTags, weakMapTag, weakSetTag };
|
package/es/internals/nodeUtil.js
CHANGED
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
import root from './root.js';
|
|
2
|
-
|
|
3
1
|
var freeExports = typeof exports === 'object' && exports && !exports.nodeType && exports;
|
|
4
2
|
var freeModule = freeExports && typeof module === 'object' && module && !module.nodeType && module;
|
|
5
|
-
var moduleExports = freeModule && freeModule.exports === freeExports;
|
|
6
|
-
var freeProcess = moduleExports && root.process;
|
|
7
3
|
var nodeUtil = (function () {
|
|
8
4
|
try {
|
|
9
5
|
var types = freeModule && freeModule.require && freeModule.require('util').types;
|
|
10
6
|
if (types) {
|
|
11
7
|
return types;
|
|
12
8
|
}
|
|
13
|
-
return freeProcess && freeProcess.binding && freeProcess.binding('util');
|
|
14
9
|
}
|
|
15
10
|
catch (e) {
|
|
16
11
|
}
|
package/es/internals/root.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
var freeGlobalThis = typeof globalThis === 'object' && globalThis && globalThis.Object === Object && globalThis;
|
|
1
2
|
var freeGlobal = typeof global === 'object' && global && global.Object === Object && global;
|
|
2
3
|
var freeSelf = typeof self === 'object' && self && self.Object === Object && self;
|
|
3
|
-
var root = freeGlobal || freeSelf || Function('return this')() || {};
|
|
4
|
+
var root = freeGlobalThis || freeGlobal || freeSelf || Function('return this')() || {};
|
|
4
5
|
var root$1 = root;
|
|
5
6
|
|
|
6
7
|
export { root$1 as default };
|
package/es/isArguments.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { objectProtoToString, argumentsTag, objectProtoHasOwnProperty, objectProtoPropertyIsEnumerable } from './internals/native.js';
|
|
2
2
|
import { supportedArgumentsType } from './internals/helpers.js';
|
|
3
3
|
import isObjectLike from './isObjectLike.js';
|
|
4
4
|
|
|
5
5
|
function isArguments(value) {
|
|
6
6
|
if (supportedArgumentsType) {
|
|
7
|
-
return
|
|
7
|
+
return objectProtoToString.call(value) === argumentsTag;
|
|
8
8
|
}
|
|
9
|
-
return isObjectLike(value) &&
|
|
9
|
+
return isObjectLike(value) && objectProtoHasOwnProperty.call(value, 'callee') && !objectProtoPropertyIsEnumerable.call(value, 'callee');
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
export { isArguments as default };
|
package/es/isArrayBuffer.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { objectProtoToString, arrayBufferTag } from './internals/native.js';
|
|
2
2
|
import { nodeIsArrayBuffer } from './internals/nodeUtil.js';
|
|
3
3
|
|
|
4
4
|
function isArrayBuffer(value) {
|
|
5
|
-
return nodeIsArrayBuffer ? nodeIsArrayBuffer(value) :
|
|
5
|
+
return nodeIsArrayBuffer ? nodeIsArrayBuffer(value) : objectProtoToString.call(value) === arrayBufferTag;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
export { isArrayBuffer as default };
|
package/es/isBlob.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { objectProtoToString, blobTag } from './internals/native.js';
|
|
2
2
|
|
|
3
3
|
var blobExisted = typeof Blob !== 'undefined';
|
|
4
4
|
function isBlob(value) {
|
|
5
5
|
if (blobExisted && value instanceof Blob) {
|
|
6
6
|
return true;
|
|
7
7
|
}
|
|
8
|
-
return
|
|
8
|
+
return objectProtoToString.call(value) === blobTag;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export { isBlob as default };
|
package/es/isBoolean.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { objectProtoToString, booleanTag } from './internals/native.js';
|
|
2
2
|
|
|
3
3
|
function isBoolean(value) {
|
|
4
|
-
return value === true || value === false ||
|
|
4
|
+
return value === true || value === false || objectProtoToString.call(value) === booleanTag;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
export { isBoolean as default };
|
package/es/isDate.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { objectProtoToString, dateTag } from './internals/native.js';
|
|
2
2
|
import { nodeIsDate } from './internals/nodeUtil.js';
|
|
3
3
|
|
|
4
4
|
function isDate(value) {
|
|
5
|
-
return nodeIsDate ? nodeIsDate(value) :
|
|
5
|
+
return nodeIsDate ? nodeIsDate(value) : objectProtoToString.call(value) === dateTag;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
export { isDate as default };
|
package/es/isEqual.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import allKeys from './allKeys.js';
|
|
2
2
|
import eq from './eq.js';
|
|
3
3
|
import getTagWithBugfix from './internals/getTagWithBugfix.js';
|
|
4
|
-
import { symbolProto, arrayBufferTag, dataViewTag, errorTag, symbolTag, regExpTag, stringTag, dateTag, booleanTag, numberTag, objectTag,
|
|
4
|
+
import { symbolProto, arrayBufferTag, dataViewTag, errorTag, symbolTag, regExpTag, stringTag, dateTag, booleanTag, numberTag, objectTag, objectProtoHasOwnProperty, argumentsTag, setTag, mapTag, arrayTag, arrayProtoSlice } from './internals/native.js';
|
|
5
5
|
import isBuffer from './isBuffer.js';
|
|
6
6
|
import isFunction from './isFunction.js';
|
|
7
7
|
import isNil from './isNil.js';
|
|
@@ -25,7 +25,7 @@ function setToArray(set) {
|
|
|
25
25
|
return orderBy(result);
|
|
26
26
|
}
|
|
27
27
|
function argToArray(arg) {
|
|
28
|
-
return
|
|
28
|
+
return arrayProtoSlice.call(arg);
|
|
29
29
|
}
|
|
30
30
|
function toBufferView(bufferSource) {
|
|
31
31
|
return new Uint8Array(bufferSource.buffer || bufferSource, bufferSource.byteOffset || 0, bufferSource.byteLength);
|
|
@@ -152,7 +152,7 @@ function isEqualDeep(value, other, customizer, strictCheck, valueStack, otherSta
|
|
|
152
152
|
continue;
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
|
-
if (!(
|
|
155
|
+
if (!(objectProtoHasOwnProperty.call(other, key) && isEqualDeep(value[key], other[key], customizer, strictCheck, valueStack, otherStack))) {
|
|
156
156
|
return false;
|
|
157
157
|
}
|
|
158
158
|
if (!skipCtor && key === 'constructor') {
|
package/es/isError.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { objectProtoToString, errorTag, domExceptionTag } from './internals/native.js';
|
|
2
2
|
import isObjectLike from './isObjectLike.js';
|
|
3
3
|
|
|
4
4
|
function isError(value) {
|
|
@@ -8,7 +8,7 @@ function isError(value) {
|
|
|
8
8
|
if (value instanceof Error) {
|
|
9
9
|
return true;
|
|
10
10
|
}
|
|
11
|
-
var tag =
|
|
11
|
+
var tag = objectProtoToString.call(value);
|
|
12
12
|
return tag === errorTag || tag === domExceptionTag;
|
|
13
13
|
}
|
|
14
14
|
|
package/es/isFunction.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { objectProtoToString, functionTags } from './internals/native.js';
|
|
2
2
|
|
|
3
3
|
function isFunction(value) {
|
|
4
4
|
if (typeof value === 'function') {
|
|
5
5
|
return true;
|
|
6
6
|
}
|
|
7
|
-
var tag =
|
|
7
|
+
var tag = objectProtoToString.call(value);
|
|
8
8
|
return functionTags.some(function (item) { return item === tag; });
|
|
9
9
|
}
|
|
10
10
|
|
package/es/isMatch.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import allKeys from './allKeys.js';
|
|
2
|
-
import {
|
|
2
|
+
import { objectProtoToString, objectTag } from './internals/native.js';
|
|
3
3
|
import isEqual from './isEqual.js';
|
|
4
4
|
|
|
5
5
|
function isDeepComparable(object, source) {
|
|
6
|
-
return
|
|
6
|
+
return objectProtoToString.call(object) === objectTag && objectProtoToString.call(source) === objectTag;
|
|
7
7
|
}
|
|
8
8
|
function baseIsMatch(object, source, customizer, strictCheck, objStack, srcStack, executedCustomizer) {
|
|
9
9
|
if (executedCustomizer === void 0) { executedCustomizer = false; }
|
package/es/isNumber.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { objectProtoToString, numberTag } from './internals/native.js';
|
|
2
2
|
|
|
3
3
|
function isNumber(value) {
|
|
4
|
-
return typeof value === 'number' ||
|
|
4
|
+
return typeof value === 'number' || objectProtoToString.call(value) === numberTag;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
export { isNumber as default };
|
package/es/isPlainObject.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import getTag from './internals/getTag.js';
|
|
2
|
-
import {
|
|
2
|
+
import { functionProtoToString, objectTag, objectGetPrototypeOf, objectProtoHasOwnProperty } from './internals/native.js';
|
|
3
3
|
import isObjectLike from './isObjectLike.js';
|
|
4
4
|
|
|
5
|
-
var objectCtorString =
|
|
5
|
+
var objectCtorString = functionProtoToString.call(Object);
|
|
6
6
|
function isPlainObject(value) {
|
|
7
7
|
if (!isObjectLike(value) || getTag(value) !== objectTag) {
|
|
8
8
|
return false;
|
|
@@ -11,8 +11,8 @@ function isPlainObject(value) {
|
|
|
11
11
|
if (proto === null) {
|
|
12
12
|
return true;
|
|
13
13
|
}
|
|
14
|
-
var Ctor =
|
|
15
|
-
return typeof Ctor === 'function' && Ctor instanceof Ctor &&
|
|
14
|
+
var Ctor = objectProtoHasOwnProperty.call(proto, 'constructor') && proto.constructor;
|
|
15
|
+
return typeof Ctor === 'function' && Ctor instanceof Ctor && functionProtoToString.call(Ctor) === objectCtorString;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export { isPlainObject as default };
|
package/es/isRegExp.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { objectProtoToString, regExpTag } from './internals/native.js';
|
|
2
2
|
import { nodeIsRegExp } from './internals/nodeUtil.js';
|
|
3
3
|
|
|
4
4
|
function isRegExp(value) {
|
|
5
|
-
return nodeIsRegExp ? nodeIsRegExp(value) :
|
|
5
|
+
return nodeIsRegExp ? nodeIsRegExp(value) : objectProtoToString.call(value) === regExpTag;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
export { isRegExp as default };
|
package/es/isString.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { objectProtoToString, stringTag } from './internals/native.js';
|
|
2
2
|
|
|
3
3
|
function isString(value) {
|
|
4
|
-
return typeof value === 'string' ||
|
|
4
|
+
return typeof value === 'string' || objectProtoToString.call(value) === stringTag;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
export { isString as default };
|
package/es/isSymbol.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { objectProtoToString, symbolTag } from './internals/native.js';
|
|
2
2
|
|
|
3
3
|
function isSymbol(value) {
|
|
4
|
-
return typeof value === 'symbol' ||
|
|
4
|
+
return typeof value === 'symbol' || objectProtoToString.call(value) === symbolTag;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
export { isSymbol as default };
|
package/es/isTypedArray.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { objectProtoToString, typedArrayTags } from './internals/native.js';
|
|
2
2
|
import { nodeIsTypedArray } from './internals/nodeUtil.js';
|
|
3
3
|
import isLength from './isLength.js';
|
|
4
4
|
import isObjectLike from './isObjectLike.js';
|
|
@@ -8,7 +8,7 @@ function isTypedArray(value) {
|
|
|
8
8
|
return nodeIsTypedArray(value);
|
|
9
9
|
}
|
|
10
10
|
if (isObjectLike(value) && isLength(value.length)) {
|
|
11
|
-
var tag_1 =
|
|
11
|
+
var tag_1 = objectProtoToString.call(value);
|
|
12
12
|
return typedArrayTags.some(function (item) { return item === tag_1; });
|
|
13
13
|
}
|
|
14
14
|
return false;
|
package/es/isWeakSet.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { objectProtoToString, weakSetTag } from './internals/native.js';
|
|
2
2
|
|
|
3
3
|
function isWeakSet(value) {
|
|
4
|
-
return
|
|
4
|
+
return objectProtoToString.call(value) === weakSetTag;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
export { isWeakSet as default };
|
package/es/nth.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { arrayProtoAt } from './internals/native.js';
|
|
2
2
|
import isArrayLike from './isArrayLike.js';
|
|
3
3
|
|
|
4
4
|
function nth(array, n) {
|
|
@@ -6,8 +6,8 @@ function nth(array, n) {
|
|
|
6
6
|
if (!isArrayLike(array)) {
|
|
7
7
|
return undefined;
|
|
8
8
|
}
|
|
9
|
-
if (typeof
|
|
10
|
-
return
|
|
9
|
+
if (typeof arrayProtoAt === 'function') {
|
|
10
|
+
return arrayProtoAt.call(array, n);
|
|
11
11
|
}
|
|
12
12
|
var index = n < 0 ? n + array.length : n;
|
|
13
13
|
return array[index];
|
|
@@ -6,7 +6,7 @@ function getSymbols(object) {
|
|
|
6
6
|
if (!native.objectGetOwnPropertySymbols || object === null) {
|
|
7
7
|
return [];
|
|
8
8
|
}
|
|
9
|
-
return native.objectGetOwnPropertySymbols(object).filter(function (item) { return native.
|
|
9
|
+
return native.objectGetOwnPropertySymbols(object).filter(function (item) { return native.objectProtoPropertyIsEnumerable.call(object, item); });
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
module.exports = getSymbols;
|
package/lib/internals/getTag.js
CHANGED
|
@@ -3,28 +3,28 @@
|
|
|
3
3
|
var native = require('./native.js');
|
|
4
4
|
|
|
5
5
|
function getRawTag(value) {
|
|
6
|
-
var isOwn = native.
|
|
7
|
-
var tag = value[native.
|
|
6
|
+
var isOwn = native.objectProtoHasOwnProperty.call(value, native.symbolToStringTag);
|
|
7
|
+
var tag = value[native.symbolToStringTag];
|
|
8
8
|
var unmasked = false;
|
|
9
9
|
try {
|
|
10
|
-
value[native.
|
|
10
|
+
value[native.symbolToStringTag] = undefined;
|
|
11
11
|
unmasked = true;
|
|
12
12
|
}
|
|
13
13
|
catch (e) {
|
|
14
14
|
}
|
|
15
|
-
var result = native.
|
|
15
|
+
var result = native.objectProtoToString.call(value);
|
|
16
16
|
if (unmasked) {
|
|
17
17
|
if (isOwn) {
|
|
18
|
-
value[native.
|
|
18
|
+
value[native.symbolToStringTag] = tag;
|
|
19
19
|
}
|
|
20
20
|
else {
|
|
21
|
-
delete value[native.
|
|
21
|
+
delete value[native.symbolToStringTag];
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
return result;
|
|
25
25
|
}
|
|
26
26
|
function getTag(value) {
|
|
27
|
-
return native.
|
|
27
|
+
return native.symbolToStringTag && native.symbolToStringTag in Object(value) ? getRawTag(value) : native.objectProtoToString.call(value);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
module.exports = getTag;
|
|
@@ -15,11 +15,11 @@ var promiseCtorString = helpers.toSource(Promise);
|
|
|
15
15
|
var setCtorString = helpers.toSource(Set);
|
|
16
16
|
var weakMapCtorString = helpers.toSource(WeakMap);
|
|
17
17
|
var getTagWithBugfix = getTag;
|
|
18
|
-
if ((dataViewExisted && native.
|
|
19
|
-
(mapExisted && native.
|
|
20
|
-
(promiseExisted && native.
|
|
21
|
-
(setExisted && native.
|
|
22
|
-
(weakMapExisted && native.
|
|
18
|
+
if ((dataViewExisted && native.objectProtoToString.call(new DataView(new ArrayBuffer(1))) !== native.dataViewTag) ||
|
|
19
|
+
(mapExisted && native.objectProtoToString.call(new Map()) !== native.mapTag) ||
|
|
20
|
+
(promiseExisted && native.objectProtoToString.call(Promise.resolve()) !== native.promiseTag) ||
|
|
21
|
+
(setExisted && native.objectProtoToString.call(new Set()) !== native.setTag) ||
|
|
22
|
+
(weakMapExisted && native.objectProtoToString.call(new WeakMap()) !== native.weakMapTag)) {
|
|
23
23
|
getTagWithBugfix = function (value) {
|
|
24
24
|
var result = getTag(value);
|
|
25
25
|
var Ctor = result === native.objectTag ? value.constructor : undefined;
|
package/lib/internals/helpers.js
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
var native = require('./native.js');
|
|
4
4
|
|
|
5
|
-
exports.VERSION = "1.
|
|
6
|
-
exports.supportedArgumentsType = native.
|
|
5
|
+
exports.VERSION = "1.5.0";
|
|
6
|
+
exports.supportedArgumentsType = native.objectProtoToString.call((function () { return arguments; })()) === native.argumentsTag;
|
|
7
7
|
exports.FUNC_ERROR_TEXT = 'Expected a function';
|
|
8
8
|
function toSource(func) {
|
|
9
9
|
if (func !== null) {
|
|
10
10
|
try {
|
|
11
|
-
return native.
|
|
11
|
+
return native.functionProtoToString.call(func);
|
|
12
12
|
}
|
|
13
13
|
catch (e) {
|
|
14
14
|
}
|
package/lib/internals/keys.js
CHANGED
|
@@ -9,7 +9,7 @@ function keys(value) {
|
|
|
9
9
|
}
|
|
10
10
|
var result = [];
|
|
11
11
|
for (var key in Object(value)) {
|
|
12
|
-
if (native.
|
|
12
|
+
if (native.objectProtoHasOwnProperty.call(value, key) && key !== 'constructor') {
|
|
13
13
|
result.push(key);
|
|
14
14
|
}
|
|
15
15
|
}
|
package/lib/internals/native.js
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
exports.objectProto = Object.prototype;
|
|
4
|
-
exports.
|
|
4
|
+
exports.objectProtoToString = exports.objectProto.toString;
|
|
5
|
+
exports.objectProtoHasOwnProperty = exports.objectProto.hasOwnProperty;
|
|
6
|
+
exports.objectProtoPropertyIsEnumerable = exports.objectProto.propertyIsEnumerable;
|
|
5
7
|
exports.objectGetOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
6
8
|
exports.objectGetPrototypeOf = Object.getPrototypeOf;
|
|
7
9
|
exports.objectKeys = Object.keys;
|
|
8
|
-
exports.
|
|
9
|
-
exports.
|
|
10
|
-
exports.functionToString = Function.prototype.toString;
|
|
10
|
+
exports.functionProto = Function.prototype;
|
|
11
|
+
exports.functionProtoToString = exports.functionProto.toString;
|
|
11
12
|
var symbolExisted = typeof Symbol !== 'undefined';
|
|
12
13
|
exports.symbolProto = symbolExisted ? Symbol.prototype : undefined;
|
|
13
|
-
exports.
|
|
14
|
+
exports.symbolToStringTag = symbolExisted ? Symbol.toStringTag : undefined;
|
|
14
15
|
exports.arrayProto = Array.prototype;
|
|
15
|
-
exports.
|
|
16
|
-
exports.
|
|
16
|
+
exports.arrayProtoSlice = exports.arrayProto.slice;
|
|
17
|
+
exports.arrayProtoAt = exports.arrayProto.at;
|
|
17
18
|
exports.numberIsFinite = Number.isFinite;
|
|
18
19
|
exports.numberIsInteger = Number.isInteger;
|
|
19
20
|
exports.numberIsSafeInteger = Number.isSafeInteger;
|
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var root = require('./root.js');
|
|
4
|
-
|
|
5
3
|
var freeExports = typeof exports === 'object' && exports && !exports.nodeType && exports;
|
|
6
4
|
var freeModule = freeExports && typeof module === 'object' && module && !module.nodeType && module;
|
|
7
|
-
var moduleExports = freeModule && freeModule.exports === freeExports;
|
|
8
|
-
var freeProcess = moduleExports && root.process;
|
|
9
5
|
var nodeUtil = (function () {
|
|
10
6
|
try {
|
|
11
7
|
var types = freeModule && freeModule.require && freeModule.require('util').types;
|
|
12
8
|
if (types) {
|
|
13
9
|
return types;
|
|
14
10
|
}
|
|
15
|
-
return freeProcess && freeProcess.binding && freeProcess.binding('util');
|
|
16
11
|
}
|
|
17
12
|
catch (e) {
|
|
18
13
|
}
|
package/lib/internals/root.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var freeGlobalThis = typeof globalThis === 'object' && globalThis && globalThis.Object === Object && globalThis;
|
|
3
4
|
var freeGlobal = typeof global === 'object' && global && global.Object === Object && global;
|
|
4
5
|
var freeSelf = typeof self === 'object' && self && self.Object === Object && self;
|
|
5
|
-
var root = freeGlobal || freeSelf || Function('return this')() || {};
|
|
6
|
+
var root = freeGlobalThis || freeGlobal || freeSelf || Function('return this')() || {};
|
|
6
7
|
var root$1 = root;
|
|
7
8
|
|
|
8
9
|
module.exports = root$1;
|
package/lib/isArguments.js
CHANGED
|
@@ -6,9 +6,9 @@ var isObjectLike = require('./isObjectLike.js');
|
|
|
6
6
|
|
|
7
7
|
function isArguments(value) {
|
|
8
8
|
if (helpers.supportedArgumentsType) {
|
|
9
|
-
return native.
|
|
9
|
+
return native.objectProtoToString.call(value) === native.argumentsTag;
|
|
10
10
|
}
|
|
11
|
-
return isObjectLike(value) && native.
|
|
11
|
+
return isObjectLike(value) && native.objectProtoHasOwnProperty.call(value, 'callee') && !native.objectProtoPropertyIsEnumerable.call(value, 'callee');
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
module.exports = isArguments;
|
package/lib/isArrayBuffer.js
CHANGED
|
@@ -4,7 +4,7 @@ var native = require('./internals/native.js');
|
|
|
4
4
|
var nodeUtil = require('./internals/nodeUtil.js');
|
|
5
5
|
|
|
6
6
|
function isArrayBuffer(value) {
|
|
7
|
-
return nodeUtil.nodeIsArrayBuffer ? nodeUtil.nodeIsArrayBuffer(value) : native.
|
|
7
|
+
return nodeUtil.nodeIsArrayBuffer ? nodeUtil.nodeIsArrayBuffer(value) : native.objectProtoToString.call(value) === native.arrayBufferTag;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
module.exports = isArrayBuffer;
|
package/lib/isBlob.js
CHANGED
package/lib/isBoolean.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var native = require('./internals/native.js');
|
|
4
4
|
|
|
5
5
|
function isBoolean(value) {
|
|
6
|
-
return value === true || value === false || native.
|
|
6
|
+
return value === true || value === false || native.objectProtoToString.call(value) === native.booleanTag;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
module.exports = isBoolean;
|
package/lib/isDate.js
CHANGED
|
@@ -4,7 +4,7 @@ var native = require('./internals/native.js');
|
|
|
4
4
|
var nodeUtil = require('./internals/nodeUtil.js');
|
|
5
5
|
|
|
6
6
|
function isDate(value) {
|
|
7
|
-
return nodeUtil.nodeIsDate ? nodeUtil.nodeIsDate(value) : native.
|
|
7
|
+
return nodeUtil.nodeIsDate ? nodeUtil.nodeIsDate(value) : native.objectProtoToString.call(value) === native.dateTag;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
module.exports = isDate;
|