ut2 1.2.0 → 1.2.2
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 +7 -13
- package/dist/ut2.js.map +1 -1
- package/dist/ut2.min.js +1 -1
- package/dist/ut2.min.js.map +1 -1
- package/es/eq.js +3 -3
- package/es/internals/helpers.js +1 -1
- package/es/merge.js +1 -3
- package/es/orderBy.js +2 -6
- package/lib/eq.js +3 -3
- package/lib/internals/helpers.js +1 -1
- package/lib/merge.js +1 -3
- package/lib/orderBy.js +2 -6
- package/package.json +1 -1
- package/types/countBy.d.ts +1 -1
- package/types/eq.d.ts +1 -1
- package/types/groupBy.d.ts +1 -1
- package/types/internals/decimalAdjust.d.ts +3 -3
- package/types/internals/isType.d.ts +1 -1
- package/types/internals/splitCaseWords.d.ts +1 -1
- package/types/kebabCase.d.ts +1 -1
- package/types/keyBy.d.ts +1 -1
- package/types/lowerCase.d.ts +1 -1
- package/types/merge.d.ts +2 -2
- package/types/omit.d.ts +1 -1
- package/types/orderBy.d.ts +2 -2
- package/types/partition.d.ts +1 -1
- package/types/pick.d.ts +1 -1
- package/types/snakeCase.d.ts +1 -1
- package/types/uniq.d.ts +1 -1
- package/types/upperCase.d.ts +1 -1
- package/types/words.d.ts +1 -1
package/es/eq.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
function eq(value, other, strictCheck) {
|
|
2
2
|
if (strictCheck === void 0) { strictCheck = false; }
|
|
3
|
-
if (
|
|
4
|
-
return
|
|
3
|
+
if (value === other) {
|
|
4
|
+
return strictCheck ? value !== 0 || 1 / value === 1 / other : true;
|
|
5
5
|
}
|
|
6
|
-
return value
|
|
6
|
+
return value !== value && other !== other;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
export { eq as default };
|
package/es/internals/helpers.js
CHANGED
|
@@ -8,6 +8,6 @@ var numberIsInteger = Number.isInteger;
|
|
|
8
8
|
var numberIsSafeInteger = Number.isSafeInteger;
|
|
9
9
|
var objectGetOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
10
10
|
var arrayAt = Array.prototype.at;
|
|
11
|
-
var VERSION = "1.2.
|
|
11
|
+
var VERSION = "1.2.2";
|
|
12
12
|
|
|
13
13
|
export { FUNC_ERROR_TEXT, VERSION, argType, arrayAt, numberIsFinite, numberIsInteger, numberIsSafeInteger, objectGetOwnPropertySymbols, supportedArgumentsType };
|
package/es/merge.js
CHANGED
|
@@ -12,9 +12,7 @@ function baseMerge(object, source, customizer, storage) {
|
|
|
12
12
|
var keys = allKeysIn(source);
|
|
13
13
|
keys.forEach(function (key) {
|
|
14
14
|
var srcValue = source[key];
|
|
15
|
-
var newValue = typeof customizer === 'function'
|
|
16
|
-
? customizer(obj[key], srcValue, key, obj, source)
|
|
17
|
-
: undefined;
|
|
15
|
+
var newValue = typeof customizer === 'function' ? customizer(obj[key], srcValue, key, obj, source) : undefined;
|
|
18
16
|
if (newValue === undefined) {
|
|
19
17
|
newValue = srcValue;
|
|
20
18
|
}
|
package/es/orderBy.js
CHANGED
|
@@ -9,9 +9,7 @@ function orderBy(collection, iteratees, orders) {
|
|
|
9
9
|
orders = (isArray(orders) ? orders : orders !== undefined ? [orders] : []);
|
|
10
10
|
if (isArray(collection)) {
|
|
11
11
|
collection.forEach(function (item, index) {
|
|
12
|
-
var criteria = iteratees.map(function (iteratee) {
|
|
13
|
-
return createIteratee(iteratee)(item);
|
|
14
|
-
});
|
|
12
|
+
var criteria = iteratees.map(function (iteratee) { return createIteratee(iteratee)(item); });
|
|
15
13
|
result.push({
|
|
16
14
|
criteria: criteria,
|
|
17
15
|
index: index,
|
|
@@ -19,9 +17,7 @@ function orderBy(collection, iteratees, orders) {
|
|
|
19
17
|
});
|
|
20
18
|
});
|
|
21
19
|
}
|
|
22
|
-
return result
|
|
23
|
-
.sort(function (a, b) { return compareMultiple(a, b, orders); })
|
|
24
|
-
.map(function (item) { return item.value; });
|
|
20
|
+
return result.sort(function (a, b) { return compareMultiple(a, b, orders); }).map(function (item) { return item.value; });
|
|
25
21
|
}
|
|
26
22
|
|
|
27
23
|
export { orderBy as default };
|
package/lib/eq.js
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
function eq(value, other, strictCheck) {
|
|
4
4
|
if (strictCheck === void 0) { strictCheck = false; }
|
|
5
|
-
if (
|
|
6
|
-
return
|
|
5
|
+
if (value === other) {
|
|
6
|
+
return strictCheck ? value !== 0 || 1 / value === 1 / other : true;
|
|
7
7
|
}
|
|
8
|
-
return value
|
|
8
|
+
return value !== value && other !== other;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
module.exports = eq;
|
package/lib/internals/helpers.js
CHANGED
|
@@ -10,4 +10,4 @@ exports.numberIsInteger = Number.isInteger;
|
|
|
10
10
|
exports.numberIsSafeInteger = Number.isSafeInteger;
|
|
11
11
|
exports.objectGetOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
12
12
|
exports.arrayAt = Array.prototype.at;
|
|
13
|
-
exports.VERSION = "1.2.
|
|
13
|
+
exports.VERSION = "1.2.2";
|
package/lib/merge.js
CHANGED
|
@@ -14,9 +14,7 @@ function baseMerge(object, source, customizer, storage) {
|
|
|
14
14
|
var keys = allKeysIn(source);
|
|
15
15
|
keys.forEach(function (key) {
|
|
16
16
|
var srcValue = source[key];
|
|
17
|
-
var newValue = typeof customizer === 'function'
|
|
18
|
-
? customizer(obj[key], srcValue, key, obj, source)
|
|
19
|
-
: undefined;
|
|
17
|
+
var newValue = typeof customizer === 'function' ? customizer(obj[key], srcValue, key, obj, source) : undefined;
|
|
20
18
|
if (newValue === undefined) {
|
|
21
19
|
newValue = srcValue;
|
|
22
20
|
}
|
package/lib/orderBy.js
CHANGED
|
@@ -11,9 +11,7 @@ function orderBy(collection, iteratees, orders) {
|
|
|
11
11
|
orders = (isArray(orders) ? orders : orders !== undefined ? [orders] : []);
|
|
12
12
|
if (isArray(collection)) {
|
|
13
13
|
collection.forEach(function (item, index) {
|
|
14
|
-
var criteria = iteratees.map(function (iteratee) {
|
|
15
|
-
return createIteratee(iteratee)(item);
|
|
16
|
-
});
|
|
14
|
+
var criteria = iteratees.map(function (iteratee) { return createIteratee(iteratee)(item); });
|
|
17
15
|
result.push({
|
|
18
16
|
criteria: criteria,
|
|
19
17
|
index: index,
|
|
@@ -21,9 +19,7 @@ function orderBy(collection, iteratees, orders) {
|
|
|
21
19
|
});
|
|
22
20
|
});
|
|
23
21
|
}
|
|
24
|
-
return result
|
|
25
|
-
.sort(function (a, b) { return compare.compareMultiple(a, b, orders); })
|
|
26
|
-
.map(function (item) { return item.value; });
|
|
22
|
+
return result.sort(function (a, b) { return compare.compareMultiple(a, b, orders); }).map(function (item) { return item.value; });
|
|
27
23
|
}
|
|
28
24
|
|
|
29
25
|
module.exports = orderBy;
|
package/package.json
CHANGED
package/types/countBy.d.ts
CHANGED
package/types/eq.d.ts
CHANGED
package/types/groupBy.d.ts
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* 数字调整。
|
|
3
3
|
*
|
|
4
4
|
* @private
|
|
5
|
-
* @param {'floor'|'ceil'|'round'}
|
|
6
|
-
* @param {number}
|
|
7
|
-
* @param {number} precision
|
|
5
|
+
* @param {'floor' | 'ceil' | 'round'} type 调整的类型。
|
|
6
|
+
* @param {number} value 要调整的数字。
|
|
7
|
+
* @param {number} precision 指数(调整基数的10个对数)。
|
|
8
8
|
* @returns {number} 调整后的数字。
|
|
9
9
|
*/
|
|
10
10
|
declare function decimalAdjust(type: 'floor' | 'ceil' | 'round', value: number, precision?: number): number;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @private
|
|
5
5
|
* @param {string} string 要拆分的字符串。
|
|
6
|
-
* @param {RegExp|string} [pattern] 拆分词组的匹配模式。
|
|
6
|
+
* @param {RegExp | string} [pattern] 拆分词组的匹配模式。
|
|
7
7
|
* @returns {string[]} 拆分后的数组。
|
|
8
8
|
*/
|
|
9
9
|
declare function splitCaseWords(string: string, pattern?: RegExp | string): string[];
|
package/types/kebabCase.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @since 1.0.0
|
|
7
7
|
* @see {@link https://en.wikipedia.org/wiki/Letter_case#Special_case_styles | kebab case}
|
|
8
8
|
* @param {string} string 要转换的字符串。
|
|
9
|
-
* @param {RegExp|string} [pattern] 拆分词组的匹配模式。
|
|
9
|
+
* @param {RegExp | string} [pattern] 拆分词组的匹配模式。
|
|
10
10
|
* @returns {string} 转换后的字符串。
|
|
11
11
|
* @example
|
|
12
12
|
*
|
package/types/keyBy.d.ts
CHANGED
package/types/lowerCase.d.ts
CHANGED
package/types/merge.d.ts
CHANGED
|
@@ -7,8 +7,8 @@ type Customizer = (objValue: any, srcValue: any, key: string | symbol, object: a
|
|
|
7
7
|
* @static
|
|
8
8
|
* @alias module:Object.merge
|
|
9
9
|
* @since 1.0.0
|
|
10
|
-
* @param {Object|Array} object 目标对象。
|
|
11
|
-
* @param {Object|Array} source 来源对象。
|
|
10
|
+
* @param {Object | Array} object 目标对象。
|
|
11
|
+
* @param {Object | Array} source 来源对象。
|
|
12
12
|
* @param {Function} [customizer] 自定义赋值函数。
|
|
13
13
|
* @returns {Object} 目标对象。
|
|
14
14
|
* @example
|
package/types/omit.d.ts
CHANGED
package/types/orderBy.d.ts
CHANGED
|
@@ -11,8 +11,8 @@ import { Order } from './internals/compare';
|
|
|
11
11
|
* @since 1.0.0
|
|
12
12
|
* @see {@link https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Array/sort | sort}
|
|
13
13
|
* @param {Array} collection 一个用来迭代的集合。
|
|
14
|
-
* @param {Function|string|Array} [iteratees] 排序的迭代函数。
|
|
15
|
-
* @param {'asc'|'desc'|Array} [orders] 迭代函数的排序顺序。
|
|
14
|
+
* @param {Function | string | Array} [iteratees] 排序的迭代函数。
|
|
15
|
+
* @param {'asc' | 'desc' | Array} [orders] 迭代函数的排序顺序。
|
|
16
16
|
* @returns {Array} 排序后的新数组。
|
|
17
17
|
* @example
|
|
18
18
|
*
|
package/types/partition.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* @alias module:Collection.partition
|
|
8
8
|
* @since 1.0.0
|
|
9
9
|
* @param {Array} collection 一个用来迭代的集合。
|
|
10
|
-
* @param {Function|string} [predicate=identity] 每次迭代调用的断言函数。
|
|
10
|
+
* @param {Function | string} [predicate=identity] 每次迭代调用的断言函数。
|
|
11
11
|
* @returns {Array} 分组后的数组。
|
|
12
12
|
* @example
|
|
13
13
|
*
|
package/types/pick.d.ts
CHANGED
package/types/snakeCase.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @since 1.0.0
|
|
7
7
|
* @see {@link https://en.wikipedia.org/wiki/Snake_case | snake case}
|
|
8
8
|
* @param {string} string 要转换的字符串。
|
|
9
|
-
* @param {RegExp|string} [pattern] 拆分词组的匹配模式。
|
|
9
|
+
* @param {RegExp | string} [pattern] 拆分词组的匹配模式。
|
|
10
10
|
* @returns {string} 转换后的字符串。
|
|
11
11
|
* @example
|
|
12
12
|
*
|
package/types/uniq.d.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @static
|
|
9
9
|
* @alias module:Array.uniq
|
|
10
10
|
* @since 1.0.0
|
|
11
|
-
* @param {Array}
|
|
11
|
+
* @param {Array} array 要检查的数组。
|
|
12
12
|
* @param {Function | string} [iteratee] 迭代函数,调用每个元素。
|
|
13
13
|
* @param {boolean} [strictCheck=false] 严格比较,区分 `+0` `-0`。
|
|
14
14
|
* @returns {Array} 去重后的新数组。
|
package/types/upperCase.d.ts
CHANGED
package/types/words.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @since 1.0.0
|
|
7
7
|
* @see {@link https://zh.wikipedia.org/wiki/ASCII | ASCII}
|
|
8
8
|
* @param {string} string 要拆分的字符串。
|
|
9
|
-
* @param {RegExp|string} [pattern=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g] 匹配模式。
|
|
9
|
+
* @param {RegExp | string} [pattern=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g] 匹配模式。
|
|
10
10
|
* @returns {string[]} 拆分后的数组。
|
|
11
11
|
* @example
|
|
12
12
|
*
|