ut2 1.9.1 → 1.9.3
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 +2 -2
- package/dist/ut2.js +13 -21
- package/dist/ut2.js.map +1 -1
- package/dist/ut2.min.js +1 -1
- package/dist/ut2.min.js.map +1 -1
- package/es/clamp.js +1 -2
- package/es/conforms.js +1 -2
- package/es/conformsTo.js +1 -2
- package/es/countBy.js +1 -2
- package/es/curry.js +1 -2
- package/es/defaultTo.js +1 -2
- package/es/escapeRegExp.js +1 -3
- package/es/every.js +1 -2
- package/es/filter.js +1 -2
- package/es/find.js +1 -2
- package/es/forEach.js +1 -2
- package/es/forEachRight.js +1 -2
- package/es/fromPairs.js +1 -2
- package/es/groupBy.js +1 -2
- package/es/gt.js +1 -2
- package/es/gte.js +1 -2
- package/es/internals/helpers.js +1 -1
- package/es/internals/native.js +1 -2
- package/es/internals/root.js +1 -2
- package/es/isObject.js +3 -2
- package/es/isPlainObject.js +1 -1
- package/es/isTypedArray.js +2 -3
- package/es/keyBy.js +1 -2
- package/es/lowerFirst.js +1 -2
- package/es/lt.js +1 -2
- package/es/lte.js +1 -2
- package/es/map.js +1 -2
- package/es/max.js +1 -2
- package/es/min.js +1 -2
- package/es/omit.js +1 -2
- package/es/orderBy.js +1 -2
- package/es/partial.js +1 -2
- package/es/partition.js +1 -2
- package/es/pick.js +1 -2
- package/es/random.js +1 -1
- package/es/randomInt.js +1 -1
- package/es/range.js +1 -2
- package/es/reduce.js +1 -2
- package/es/reduceRight.js +1 -2
- package/es/some.js +1 -2
- package/es/times.js +1 -2
- package/es/toNumber.js +1 -5
- package/es/uniqueId.js +4 -4
- package/es/upperFirst.js +1 -2
- package/lib/clamp.js +1 -2
- package/lib/conforms.js +1 -2
- package/lib/conformsTo.js +1 -2
- package/lib/countBy.js +1 -2
- package/lib/curry.js +1 -2
- package/lib/defaultTo.js +1 -2
- package/lib/escapeRegExp.js +1 -3
- package/lib/every.js +1 -2
- package/lib/filter.js +1 -2
- package/lib/find.js +1 -2
- package/lib/forEach.js +1 -2
- package/lib/forEachRight.js +1 -2
- package/lib/fromPairs.js +1 -2
- package/lib/groupBy.js +1 -2
- package/lib/gt.js +1 -2
- package/lib/gte.js +1 -2
- package/lib/index.js +4 -16
- package/lib/internals/comparator.js +8 -4
- package/lib/internals/helpers.js +10 -5
- package/lib/internals/native.js +104 -53
- package/lib/internals/nodeUtil.js +13 -6
- package/lib/internals/root.js +1 -2
- package/lib/isObject.js +3 -2
- package/lib/isTypedArray.js +2 -3
- package/lib/keyBy.js +1 -2
- package/lib/lowerFirst.js +1 -2
- package/lib/lt.js +1 -2
- package/lib/lte.js +1 -2
- package/lib/map.js +1 -2
- package/lib/max.js +1 -2
- package/lib/min.js +1 -2
- package/lib/omit.js +1 -2
- package/lib/orderBy.js +1 -2
- package/lib/partial.js +1 -2
- package/lib/partition.js +1 -2
- package/lib/pick.js +1 -2
- package/lib/range.js +1 -2
- package/lib/reduce.js +1 -2
- package/lib/reduceRight.js +1 -2
- package/lib/some.js +1 -2
- package/lib/times.js +1 -2
- package/lib/toNumber.js +1 -5
- package/lib/uniqueId.js +4 -4
- package/lib/upperFirst.js +1 -2
- package/package.json +19 -19
- package/types/camelCase.d.ts +1 -1
- package/types/ceil.d.ts +1 -1
- package/types/compact.d.ts +1 -1
- package/types/delay.d.ts +0 -1
- package/types/eq.d.ts +1 -1
- package/types/escape.d.ts +1 -1
- package/types/escapeRegExp.d.ts +1 -1
- package/types/floor.d.ts +1 -1
- package/types/internals/native.d.ts +4 -5
- package/types/isArrayLikeObject.d.ts +1 -1
- package/types/isBlob.d.ts +2 -2
- package/types/isBuffer.d.ts +0 -1
- package/types/isElement.d.ts +1 -1
- package/types/isLength.d.ts +1 -1
- package/types/isObject.d.ts +3 -2
- package/types/isObjectLike.d.ts +1 -1
- package/types/isPlainObject.d.ts +1 -1
- package/types/isPromiseLike.d.ts +6 -1
- package/types/isTypedArray.d.ts +1 -1
- package/types/kebabCase.d.ts +1 -1
- package/types/merge.d.ts +1 -1
- package/types/orderBy.d.ts +1 -1
- package/types/pascalCase.d.ts +1 -1
- package/types/random.d.ts +10 -6
- package/types/randomInt.d.ts +9 -5
- package/types/round.d.ts +1 -1
- package/types/snakeCase.d.ts +1 -1
- package/types/toLength.d.ts +1 -1
- package/types/uniqueId.d.ts +3 -3
- package/types/words.d.ts +1 -1
- package/types/xor.d.ts +1 -1
package/README.md
CHANGED
|
@@ -151,10 +151,10 @@ const debounced = debounce(() => {
|
|
|
151
151
|
- [Object](https://caijf.github.io/ut2/module-Object.html) 对象
|
|
152
152
|
- [allKeys](https://caijf.github.io/ut2/module-Object.html#.allKeys) - 对象自身的可枚举属性(包含 `Symbol` 属性)。
|
|
153
153
|
- [allKeysIn](https://caijf.github.io/ut2/module-Object.html#.allKeysIn) - 对象自身及继承的可枚举属性(包含 `Symbol` 属性)。
|
|
154
|
-
- [invert](https://caijf.github.io/ut2/module-Object.html#.invert) -
|
|
154
|
+
- [invert](https://caijf.github.io/ut2/module-Object.html#.invert) - 对象自身的可枚举属性(包含 `Symbol` 属性)和值反转。
|
|
155
155
|
- [keys](https://caijf.github.io/ut2/module-Object.html#.keys) - 对象自身的可枚举属性(不包含 `Symbol` 属性)。
|
|
156
156
|
- [keysIn](https://caijf.github.io/ut2/module-Object.html#.keysIn) - 对象自身及继承的可枚举属性(不包含 `Symbol` 属性)。
|
|
157
|
-
- [merge](https://caijf.github.io/ut2/module-Object.html#.merge) -
|
|
157
|
+
- [merge](https://caijf.github.io/ut2/module-Object.html#.merge) - 递归对象自身的可枚举属性(包含 `Symbol` 属性)或数组进行合并。
|
|
158
158
|
- [omit](https://caijf.github.io/ut2/module-Object.html#.omit) - 排除部分属性。
|
|
159
159
|
- [omitBy](https://caijf.github.io/ut2/module-Object.html#.omitBy) - 根据方法,排除部分属性。
|
|
160
160
|
- [pick](https://caijf.github.io/ut2/module-Object.html#.pick) - 选择部分属性。
|
package/dist/ut2.js
CHANGED
|
@@ -46,7 +46,6 @@
|
|
|
46
46
|
var arrayBufferTag = '[object ArrayBuffer]';
|
|
47
47
|
var argumentsTag = '[object Arguments]';
|
|
48
48
|
var arrayTag = '[object Array]';
|
|
49
|
-
var typedArrayTags = ['Float32Array', 'Float64Array', 'Int8Array', 'Int16Array', 'Int32Array', 'Uint8Array', 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'BigInt64Array', 'BigUint64Array'].map(function (item) { return '[object ' + item + ']'; });
|
|
50
49
|
var functionTags = ['Function', 'AsyncFunction', 'GeneratorFunction', 'Proxy'].map(function (item) { return '[object ' + item + ']'; });
|
|
51
50
|
var weakSetTag = '[object WeakSet]';
|
|
52
51
|
var blobTag = '[object Blob]';
|
|
@@ -62,9 +61,12 @@
|
|
|
62
61
|
return Array.isArray(value);
|
|
63
62
|
}
|
|
64
63
|
|
|
64
|
+
function isObjectLike(value) {
|
|
65
|
+
return value !== null && typeof value === 'object';
|
|
66
|
+
}
|
|
67
|
+
|
|
65
68
|
function isObject(value) {
|
|
66
|
-
|
|
67
|
-
return type === 'function' || (type === 'object' && !!value);
|
|
69
|
+
return typeof value === 'function' || isObjectLike(value);
|
|
68
70
|
}
|
|
69
71
|
|
|
70
72
|
function getTag(value) {
|
|
@@ -93,11 +95,7 @@
|
|
|
93
95
|
}
|
|
94
96
|
value = value.trim();
|
|
95
97
|
var isBinary = reIsBinary.test(value);
|
|
96
|
-
return isBinary || reIsOctal.test(value)
|
|
97
|
-
? parseInt(value.slice(2), isBinary ? 2 : 8)
|
|
98
|
-
: reIsBadHex.test(value)
|
|
99
|
-
? NaN
|
|
100
|
-
: +value;
|
|
98
|
+
return isBinary || reIsOctal.test(value) ? parseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NaN : +value;
|
|
101
99
|
}
|
|
102
100
|
|
|
103
101
|
function toInteger(value) {
|
|
@@ -299,10 +297,6 @@
|
|
|
299
297
|
return uniq(array.concat(other), iteratee, strickCheck);
|
|
300
298
|
}
|
|
301
299
|
|
|
302
|
-
function isObjectLike(value) {
|
|
303
|
-
return value !== null && typeof value === 'object';
|
|
304
|
-
}
|
|
305
|
-
|
|
306
300
|
function isArrayLikeObject(value) {
|
|
307
301
|
return isObjectLike(value) && isArrayLike(value);
|
|
308
302
|
}
|
|
@@ -605,7 +599,7 @@
|
|
|
605
599
|
return value == null || value !== value ? defaultValue : value;
|
|
606
600
|
};
|
|
607
601
|
|
|
608
|
-
var VERSION = "1.9.
|
|
602
|
+
var VERSION = "1.9.3";
|
|
609
603
|
var supportedArgumentsType = getTag((function () { return arguments; })()) === argumentsTag;
|
|
610
604
|
var FUNC_ERROR_TEXT = 'Expected a function';
|
|
611
605
|
function toSource(func) {
|
|
@@ -958,13 +952,13 @@
|
|
|
958
952
|
return true;
|
|
959
953
|
}
|
|
960
954
|
|
|
955
|
+
var typedArrayPattern = /\[object ((I|Ui)nt(8|16|32)|Float(32|64)|Uint8Clamped|Big(I|Ui)nt64)Array\]/;
|
|
961
956
|
function isTypedArray(value) {
|
|
962
957
|
if (nodeIsTypedArray) {
|
|
963
958
|
return nodeIsTypedArray(value);
|
|
964
959
|
}
|
|
965
960
|
if (isObjectLike(value) && isLength(value.length)) {
|
|
966
|
-
|
|
967
|
-
return typedArrayTags.some(function (item) { return item === tag_1; });
|
|
961
|
+
return typedArrayPattern.test(getTag(value));
|
|
968
962
|
}
|
|
969
963
|
return false;
|
|
970
964
|
}
|
|
@@ -1603,9 +1597,7 @@
|
|
|
1603
1597
|
var reRegExpChar = /[\\^$.*+?\-()[\]{}|]/g;
|
|
1604
1598
|
var reHasRegExpChar = RegExp(reRegExpChar.source);
|
|
1605
1599
|
function escapeRegExp(string) {
|
|
1606
|
-
return string && reHasRegExpChar.test(string)
|
|
1607
|
-
? string.replace(reRegExpChar, '\\$&')
|
|
1608
|
-
: string || '';
|
|
1600
|
+
return string && reHasRegExpChar.test(string) ? string.replace(reRegExpChar, '\\$&') : string || '';
|
|
1609
1601
|
}
|
|
1610
1602
|
|
|
1611
1603
|
function kebabCase(string, pattern) {
|
|
@@ -1765,10 +1757,10 @@
|
|
|
1765
1757
|
}
|
|
1766
1758
|
|
|
1767
1759
|
var idCounter = 0;
|
|
1760
|
+
var defaultPrefix = '_' + mathRandom().toString(36).substring(2, 4);
|
|
1768
1761
|
function uniqueId(prefix) {
|
|
1769
|
-
if (prefix === void 0) { prefix =
|
|
1770
|
-
|
|
1771
|
-
return toString(prefix) + id;
|
|
1762
|
+
if (prefix === void 0) { prefix = defaultPrefix; }
|
|
1763
|
+
return '' + prefix + ++idCounter;
|
|
1772
1764
|
}
|
|
1773
1765
|
|
|
1774
1766
|
exports.MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH;
|