ut2 1.4.10 → 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/dist/ut2.js +52 -54
- 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/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/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 +4 -1
- package/types/internals/native.d.ts +8 -7
package/dist/ut2.js
CHANGED
|
@@ -9,19 +9,20 @@
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
var objectProto = Object.prototype;
|
|
12
|
-
var
|
|
12
|
+
var objectProtoToString = objectProto.toString;
|
|
13
|
+
var objectProtoHasOwnProperty = objectProto.hasOwnProperty;
|
|
14
|
+
var objectProtoPropertyIsEnumerable = objectProto.propertyIsEnumerable;
|
|
13
15
|
var objectGetOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
14
16
|
var objectGetPrototypeOf = Object.getPrototypeOf;
|
|
15
17
|
var objectKeys = Object.keys;
|
|
16
|
-
var
|
|
17
|
-
var
|
|
18
|
-
var functionToString = Function.prototype.toString;
|
|
18
|
+
var functionProto = Function.prototype;
|
|
19
|
+
var functionProtoToString = functionProto.toString;
|
|
19
20
|
var symbolExisted = typeof Symbol !== 'undefined';
|
|
20
21
|
var symbolProto = symbolExisted ? Symbol.prototype : undefined;
|
|
21
|
-
var
|
|
22
|
+
var symbolToStringTag = symbolExisted ? Symbol.toStringTag : undefined;
|
|
22
23
|
var arrayProto = Array.prototype;
|
|
23
|
-
var
|
|
24
|
-
var
|
|
24
|
+
var arrayProtoSlice = arrayProto.slice;
|
|
25
|
+
var arrayProtoAt = arrayProto.at;
|
|
25
26
|
var numberIsFinite = Number.isFinite;
|
|
26
27
|
var numberIsInteger = Number.isInteger;
|
|
27
28
|
var numberIsSafeInteger = Number.isSafeInteger;
|
|
@@ -56,7 +57,7 @@
|
|
|
56
57
|
}
|
|
57
58
|
|
|
58
59
|
function isSymbol(value) {
|
|
59
|
-
return typeof value === 'symbol' ||
|
|
60
|
+
return typeof value === 'symbol' || objectProtoToString.call(value) === symbolTag;
|
|
60
61
|
}
|
|
61
62
|
|
|
62
63
|
var reIsBinary = /^0b[01]+$/i;
|
|
@@ -191,7 +192,7 @@
|
|
|
191
192
|
if (typeof value === 'function') {
|
|
192
193
|
return true;
|
|
193
194
|
}
|
|
194
|
-
var tag =
|
|
195
|
+
var tag = objectProtoToString.call(value);
|
|
195
196
|
return functionTags.some(function (item) { return item === tag; });
|
|
196
197
|
}
|
|
197
198
|
|
|
@@ -208,8 +209,8 @@
|
|
|
208
209
|
if (!isArrayLike(array)) {
|
|
209
210
|
return undefined;
|
|
210
211
|
}
|
|
211
|
-
if (typeof
|
|
212
|
-
return
|
|
212
|
+
if (typeof arrayProtoAt === 'function') {
|
|
213
|
+
return arrayProtoAt.call(array, n);
|
|
213
214
|
}
|
|
214
215
|
var index = n < 0 ? n + array.length : n;
|
|
215
216
|
return array[index];
|
|
@@ -475,13 +476,13 @@
|
|
|
475
476
|
return value == null || value !== value ? defaultValue : value;
|
|
476
477
|
}
|
|
477
478
|
|
|
478
|
-
var VERSION = "1.
|
|
479
|
-
var supportedArgumentsType =
|
|
479
|
+
var VERSION = "1.5.0";
|
|
480
|
+
var supportedArgumentsType = objectProtoToString.call((function () { return arguments; })()) === argumentsTag;
|
|
480
481
|
var FUNC_ERROR_TEXT = 'Expected a function';
|
|
481
482
|
function toSource(func) {
|
|
482
483
|
if (func !== null) {
|
|
483
484
|
try {
|
|
484
|
-
return
|
|
485
|
+
return functionProtoToString.call(func);
|
|
485
486
|
}
|
|
486
487
|
catch (e) {
|
|
487
488
|
}
|
|
@@ -665,27 +666,19 @@
|
|
|
665
666
|
|
|
666
667
|
function isArguments(value) {
|
|
667
668
|
if (supportedArgumentsType) {
|
|
668
|
-
return
|
|
669
|
+
return objectProtoToString.call(value) === argumentsTag;
|
|
669
670
|
}
|
|
670
|
-
return isObjectLike(value) &&
|
|
671
|
+
return isObjectLike(value) && objectProtoHasOwnProperty.call(value, 'callee') && !objectProtoPropertyIsEnumerable.call(value, 'callee');
|
|
671
672
|
}
|
|
672
673
|
|
|
673
|
-
var freeGlobalThis = typeof globalThis === 'object' && globalThis && globalThis.Object === Object && globalThis;
|
|
674
|
-
var freeGlobal = typeof global === 'object' && global && global.Object === Object && global;
|
|
675
|
-
var freeSelf = typeof self === 'object' && self && self.Object === Object && self;
|
|
676
|
-
var root = freeGlobalThis || freeGlobal || freeSelf || Function('return this')() || {};
|
|
677
|
-
|
|
678
674
|
var freeExports = typeof exports === 'object' && exports && !exports.nodeType && exports;
|
|
679
675
|
var freeModule = freeExports && typeof module === 'object' && module && !module.nodeType && module;
|
|
680
|
-
var moduleExports = freeModule && freeModule.exports === freeExports;
|
|
681
|
-
var freeProcess = moduleExports && root.process;
|
|
682
676
|
var nodeUtil = (function () {
|
|
683
677
|
try {
|
|
684
678
|
var types = freeModule && freeModule.require && freeModule.require('util').types;
|
|
685
679
|
if (types) {
|
|
686
680
|
return types;
|
|
687
681
|
}
|
|
688
|
-
return freeProcess && freeProcess.binding && freeProcess.binding('util');
|
|
689
682
|
}
|
|
690
683
|
catch (e) {
|
|
691
684
|
}
|
|
@@ -698,7 +691,7 @@
|
|
|
698
691
|
var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
|
|
699
692
|
|
|
700
693
|
function isArrayBuffer(value) {
|
|
701
|
-
return nodeIsArrayBuffer ? nodeIsArrayBuffer(value) :
|
|
694
|
+
return nodeIsArrayBuffer ? nodeIsArrayBuffer(value) : objectProtoToString.call(value) === arrayBufferTag;
|
|
702
695
|
}
|
|
703
696
|
|
|
704
697
|
var blobExisted = typeof Blob !== 'undefined';
|
|
@@ -706,11 +699,11 @@
|
|
|
706
699
|
if (blobExisted && value instanceof Blob) {
|
|
707
700
|
return true;
|
|
708
701
|
}
|
|
709
|
-
return
|
|
702
|
+
return objectProtoToString.call(value) === blobTag;
|
|
710
703
|
}
|
|
711
704
|
|
|
712
705
|
function isBoolean(value) {
|
|
713
|
-
return value === true || value === false ||
|
|
706
|
+
return value === true || value === false || objectProtoToString.call(value) === booleanTag;
|
|
714
707
|
}
|
|
715
708
|
|
|
716
709
|
function isBuffer(value) {
|
|
@@ -724,28 +717,28 @@
|
|
|
724
717
|
}
|
|
725
718
|
|
|
726
719
|
function getRawTag(value) {
|
|
727
|
-
var isOwn =
|
|
728
|
-
var tag = value[
|
|
720
|
+
var isOwn = objectProtoHasOwnProperty.call(value, symbolToStringTag);
|
|
721
|
+
var tag = value[symbolToStringTag];
|
|
729
722
|
var unmasked = false;
|
|
730
723
|
try {
|
|
731
|
-
value[
|
|
724
|
+
value[symbolToStringTag] = undefined;
|
|
732
725
|
unmasked = true;
|
|
733
726
|
}
|
|
734
727
|
catch (e) {
|
|
735
728
|
}
|
|
736
|
-
var result =
|
|
729
|
+
var result = objectProtoToString.call(value);
|
|
737
730
|
if (unmasked) {
|
|
738
731
|
if (isOwn) {
|
|
739
|
-
value[
|
|
732
|
+
value[symbolToStringTag] = tag;
|
|
740
733
|
}
|
|
741
734
|
else {
|
|
742
|
-
delete value[
|
|
735
|
+
delete value[symbolToStringTag];
|
|
743
736
|
}
|
|
744
737
|
}
|
|
745
738
|
return result;
|
|
746
739
|
}
|
|
747
740
|
function getTag(value) {
|
|
748
|
-
return
|
|
741
|
+
return symbolToStringTag && symbolToStringTag in Object(value) ? getRawTag(value) : objectProtoToString.call(value);
|
|
749
742
|
}
|
|
750
743
|
|
|
751
744
|
var dataViewExisted = typeof DataView !== 'undefined';
|
|
@@ -759,11 +752,11 @@
|
|
|
759
752
|
var setCtorString = toSource(Set);
|
|
760
753
|
var weakMapCtorString = toSource(WeakMap);
|
|
761
754
|
var getTagWithBugfix = getTag;
|
|
762
|
-
if ((dataViewExisted &&
|
|
763
|
-
(mapExisted &&
|
|
764
|
-
(promiseExisted &&
|
|
765
|
-
(setExisted &&
|
|
766
|
-
(weakMapExisted &&
|
|
755
|
+
if ((dataViewExisted && objectProtoToString.call(new DataView(new ArrayBuffer(1))) !== dataViewTag) ||
|
|
756
|
+
(mapExisted && objectProtoToString.call(new Map()) !== mapTag) ||
|
|
757
|
+
(promiseExisted && objectProtoToString.call(Promise.resolve()) !== promiseTag) ||
|
|
758
|
+
(setExisted && objectProtoToString.call(new Set()) !== setTag) ||
|
|
759
|
+
(weakMapExisted && objectProtoToString.call(new WeakMap()) !== weakMapTag)) {
|
|
767
760
|
getTagWithBugfix = function (value) {
|
|
768
761
|
var result = getTag(value);
|
|
769
762
|
var Ctor = result === objectTag ? value.constructor : undefined;
|
|
@@ -792,10 +785,10 @@
|
|
|
792
785
|
}
|
|
793
786
|
|
|
794
787
|
function isDate(value) {
|
|
795
|
-
return nodeIsDate ? nodeIsDate(value) :
|
|
788
|
+
return nodeIsDate ? nodeIsDate(value) : objectProtoToString.call(value) === dateTag;
|
|
796
789
|
}
|
|
797
790
|
|
|
798
|
-
var objectCtorString =
|
|
791
|
+
var objectCtorString = functionProtoToString.call(Object);
|
|
799
792
|
function isPlainObject(value) {
|
|
800
793
|
if (!isObjectLike(value) || getTag(value) !== objectTag) {
|
|
801
794
|
return false;
|
|
@@ -804,8 +797,8 @@
|
|
|
804
797
|
if (proto === null) {
|
|
805
798
|
return true;
|
|
806
799
|
}
|
|
807
|
-
var Ctor =
|
|
808
|
-
return typeof Ctor === 'function' && Ctor instanceof Ctor &&
|
|
800
|
+
var Ctor = objectProtoHasOwnProperty.call(proto, 'constructor') && proto.constructor;
|
|
801
|
+
return typeof Ctor === 'function' && Ctor instanceof Ctor && functionProtoToString.call(Ctor) === objectCtorString;
|
|
809
802
|
}
|
|
810
803
|
|
|
811
804
|
function isElement(value) {
|
|
@@ -827,7 +820,7 @@
|
|
|
827
820
|
}
|
|
828
821
|
var result = [];
|
|
829
822
|
for (var key in Object(value)) {
|
|
830
|
-
if (
|
|
823
|
+
if (objectProtoHasOwnProperty.call(value, key) && key !== 'constructor') {
|
|
831
824
|
result.push(key);
|
|
832
825
|
}
|
|
833
826
|
}
|
|
@@ -865,7 +858,7 @@
|
|
|
865
858
|
if (!objectGetOwnPropertySymbols || object === null) {
|
|
866
859
|
return [];
|
|
867
860
|
}
|
|
868
|
-
return objectGetOwnPropertySymbols(object).filter(function (item) { return
|
|
861
|
+
return objectGetOwnPropertySymbols(object).filter(function (item) { return objectProtoPropertyIsEnumerable.call(object, item); });
|
|
869
862
|
}
|
|
870
863
|
|
|
871
864
|
function allKeys(object) {
|
|
@@ -884,7 +877,7 @@
|
|
|
884
877
|
return nodeIsTypedArray(value);
|
|
885
878
|
}
|
|
886
879
|
if (isObjectLike(value) && isLength(value.length)) {
|
|
887
|
-
var tag_1 =
|
|
880
|
+
var tag_1 = objectProtoToString.call(value);
|
|
888
881
|
return typedArrayTags.some(function (item) { return item === tag_1; });
|
|
889
882
|
}
|
|
890
883
|
return false;
|
|
@@ -906,7 +899,7 @@
|
|
|
906
899
|
return orderBy(result);
|
|
907
900
|
}
|
|
908
901
|
function argToArray(arg) {
|
|
909
|
-
return
|
|
902
|
+
return arrayProtoSlice.call(arg);
|
|
910
903
|
}
|
|
911
904
|
function toBufferView(bufferSource) {
|
|
912
905
|
return new Uint8Array(bufferSource.buffer || bufferSource, bufferSource.byteOffset || 0, bufferSource.byteLength);
|
|
@@ -1033,7 +1026,7 @@
|
|
|
1033
1026
|
continue;
|
|
1034
1027
|
}
|
|
1035
1028
|
}
|
|
1036
|
-
if (!(
|
|
1029
|
+
if (!(objectProtoHasOwnProperty.call(other, key) && isEqualDeep(value[key], other[key], customizer, strictCheck, valueStack, otherStack))) {
|
|
1037
1030
|
return false;
|
|
1038
1031
|
}
|
|
1039
1032
|
if (!skipCtor && key === 'constructor') {
|
|
@@ -1073,10 +1066,15 @@
|
|
|
1073
1066
|
if (value instanceof Error) {
|
|
1074
1067
|
return true;
|
|
1075
1068
|
}
|
|
1076
|
-
var tag =
|
|
1069
|
+
var tag = objectProtoToString.call(value);
|
|
1077
1070
|
return tag === errorTag || tag === domExceptionTag;
|
|
1078
1071
|
}
|
|
1079
1072
|
|
|
1073
|
+
var freeGlobalThis = typeof globalThis === 'object' && globalThis && globalThis.Object === Object && globalThis;
|
|
1074
|
+
var freeGlobal = typeof global === 'object' && global && global.Object === Object && global;
|
|
1075
|
+
var freeSelf = typeof self === 'object' && self && self.Object === Object && self;
|
|
1076
|
+
var root = freeGlobalThis || freeGlobal || freeSelf || Function('return this')() || {};
|
|
1077
|
+
|
|
1080
1078
|
function isFinite(value) {
|
|
1081
1079
|
return numberIsFinite ? numberIsFinite(value) : typeof value === 'number' && root.isFinite(value);
|
|
1082
1080
|
}
|
|
@@ -1086,7 +1084,7 @@
|
|
|
1086
1084
|
}
|
|
1087
1085
|
|
|
1088
1086
|
function isDeepComparable(object, source) {
|
|
1089
|
-
return
|
|
1087
|
+
return objectProtoToString.call(object) === objectTag && objectProtoToString.call(source) === objectTag;
|
|
1090
1088
|
}
|
|
1091
1089
|
function baseIsMatch(object, source, customizer, strictCheck, objStack, srcStack, executedCustomizer) {
|
|
1092
1090
|
if (executedCustomizer === void 0) { executedCustomizer = false; }
|
|
@@ -1152,7 +1150,7 @@
|
|
|
1152
1150
|
}
|
|
1153
1151
|
|
|
1154
1152
|
function isNumber(value) {
|
|
1155
|
-
return typeof value === 'number' ||
|
|
1153
|
+
return typeof value === 'number' || objectProtoToString.call(value) === numberTag;
|
|
1156
1154
|
}
|
|
1157
1155
|
|
|
1158
1156
|
function isNaN(value) {
|
|
@@ -1168,7 +1166,7 @@
|
|
|
1168
1166
|
}
|
|
1169
1167
|
|
|
1170
1168
|
function isRegExp(value) {
|
|
1171
|
-
return nodeIsRegExp ? nodeIsRegExp(value) :
|
|
1169
|
+
return nodeIsRegExp ? nodeIsRegExp(value) : objectProtoToString.call(value) === regExpTag;
|
|
1172
1170
|
}
|
|
1173
1171
|
|
|
1174
1172
|
function isSafeInteger(value) {
|
|
@@ -1176,7 +1174,7 @@
|
|
|
1176
1174
|
}
|
|
1177
1175
|
|
|
1178
1176
|
function isString(value) {
|
|
1179
|
-
return typeof value === 'string' ||
|
|
1177
|
+
return typeof value === 'string' || objectProtoToString.call(value) === stringTag;
|
|
1180
1178
|
}
|
|
1181
1179
|
|
|
1182
1180
|
function isUndefined(value) {
|
|
@@ -1188,7 +1186,7 @@
|
|
|
1188
1186
|
}
|
|
1189
1187
|
|
|
1190
1188
|
function isWeakSet(value) {
|
|
1191
|
-
return
|
|
1189
|
+
return objectProtoToString.call(value) === weakSetTag;
|
|
1192
1190
|
}
|
|
1193
1191
|
|
|
1194
1192
|
function decimalAdjust(type, value, precision) {
|