ut2 1.1.3 → 1.2.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 +2 -0
- package/dist/ut2.js +35 -19
- package/dist/ut2.js.map +1 -1
- package/dist/ut2.min.js +1 -1
- package/dist/ut2.min.js.map +1 -1
- package/es/difference.js +3 -2
- package/es/eq.js +5 -1
- package/es/index.js +2 -0
- package/es/internals/helpers.js +1 -1
- package/es/intersection.js +3 -3
- package/es/isDataView.js +7 -0
- package/es/isPlainObject.js +1 -3
- package/es/once.js +7 -0
- package/es/union.js +3 -2
- package/es/uniq.js +3 -2
- package/es/xor.js +6 -5
- package/lib/difference.js +3 -2
- package/lib/eq.js +5 -1
- package/lib/index.js +4 -0
- package/lib/internals/helpers.js +1 -1
- package/lib/intersection.js +3 -3
- package/lib/isDataView.js +9 -0
- package/lib/isPlainObject.js +1 -3
- package/lib/once.js +9 -0
- package/lib/union.js +3 -2
- package/lib/uniq.js +3 -2
- package/lib/xor.js +6 -5
- package/package.json +1 -1
- package/types/before.d.ts +0 -7
- package/types/difference.d.ts +9 -2
- package/types/eq.d.ts +8 -2
- package/types/index.d.ts +2 -0
- package/types/intersection.d.ts +9 -2
- package/types/isArrayLikeObject.d.ts +4 -4
- package/types/isBuffer.d.ts +1 -1
- package/types/isDataView.d.ts +15 -0
- package/types/isPlainObject.d.ts +3 -3
- package/types/isTypedArray.d.ts +2 -2
- package/types/once.d.ts +24 -0
- package/types/toFinite.d.ts +8 -8
- package/types/union.d.ts +11 -4
- package/types/uniq.d.ts +9 -2
- package/types/xor.d.ts +13 -6
package/types/union.d.ts
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* 创建一个按顺序排列的唯一值的数组(并集)。如果传入迭代函数,会调用数组的每个元素以产生唯一性计算的标准。与 [`uniq`](#.uniq) 相似。
|
|
3
3
|
*
|
|
4
4
|
* `iteratee` 调用时会传入 1 个参数 `value` 。
|
|
5
5
|
*
|
|
6
|
+
* 默认使用了 [`SameValueZero`](https://tc39.es/ecma262/#sec-samevaluezero) 做等值比较。如果 `strictCheck=true` 将使用 [`SameValue`](https://tc39.es/ecma262/#sec-samevalue) 做等值比较。
|
|
7
|
+
*
|
|
6
8
|
* @static
|
|
7
9
|
* @alias module:Array.union
|
|
8
10
|
* @since 1.0.0
|
|
9
11
|
* @param {Array} array 要检查的数组。
|
|
10
12
|
* @param {Array} [other=[]] 另一个要检查的数组。
|
|
11
13
|
* @param {Function | string} [iteratee] 迭代函数,调用每个元素。
|
|
14
|
+
* @param {boolean} [strictCheck=false] 严格比较,区分 `+0` `-0`。
|
|
12
15
|
* @returns {Array} 新的联合数组。
|
|
13
16
|
* @example
|
|
14
17
|
*
|
|
@@ -16,11 +19,15 @@
|
|
|
16
19
|
*
|
|
17
20
|
* union([2.1], [1.2, 2.3], Math.floor); // [2.1, 1.2]
|
|
18
21
|
*
|
|
19
|
-
*
|
|
22
|
+
* union([{x: 1}, {x: 1}, {x: 2}, {x: 2}], [{x: 1}], item=>item.x); // [{x: 1}, {x: 2}]
|
|
20
23
|
*
|
|
21
24
|
* // 迭代函数可以直接写入属性。
|
|
22
|
-
*
|
|
25
|
+
* union([{x: 1}, {x: 1}, {x: 2}, {x: 2}], [{x: 1}], 'x'); // [{x: 1}, {x: 2}]
|
|
26
|
+
*
|
|
27
|
+
* union([-0, 0], [-0]); // [-0]
|
|
28
|
+
*
|
|
29
|
+
* union([-0, 0], [-0], undefined, true); // [-0, 0]
|
|
23
30
|
*
|
|
24
31
|
*/
|
|
25
|
-
declare function union<T, F extends (value: T) => any, K extends keyof T>(array: T[], other?: T[], iteratee?: F | K): T[];
|
|
32
|
+
declare function union<T, F extends (value: T) => any, K extends keyof T>(array: T[], other?: T[], iteratee?: F | K, strickCheck?: boolean): T[];
|
|
26
33
|
export default union;
|
package/types/uniq.d.ts
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* 创建一个去重后的数组副本。只有第一次出现的元素才会被保留。如果传入迭代函数,会调用数组的每个元素以产生唯一性计算的标准。
|
|
3
3
|
*
|
|
4
4
|
* `iteratee` 调用时会传入 1 个参数 `value` 。
|
|
5
5
|
*
|
|
6
|
+
* 默认使用了 [`SameValueZero`](https://tc39.es/ecma262/#sec-samevaluezero) 做等值比较。如果 `strictCheck=true` 将使用 [`SameValue`](https://tc39.es/ecma262/#sec-samevalue) 做等值比较。
|
|
7
|
+
*
|
|
6
8
|
* @static
|
|
7
9
|
* @alias module:Array.uniq
|
|
8
10
|
* @since 1.0.0
|
|
9
11
|
* @param {Array} array 要检查的数组。
|
|
10
12
|
* @param {Function | string} [iteratee] 迭代函数,调用每个元素。
|
|
13
|
+
* @param {boolean} [strictCheck=false] 严格比较,区分 `+0` `-0`。
|
|
11
14
|
* @returns {Array} 去重后的新数组。
|
|
12
15
|
* @example
|
|
13
16
|
*
|
|
@@ -20,6 +23,10 @@
|
|
|
20
23
|
* // 迭代函数可以直接写入属性。
|
|
21
24
|
* uniq([{x: 1}, {x: 2}, {x: 1}], 'x'); // [{x: 1}, {x: 2}]
|
|
22
25
|
*
|
|
26
|
+
* uniq([-0, 0]); // [-0]
|
|
27
|
+
*
|
|
28
|
+
* uniq([-0, 0], undefined, true); // [-0, 0]
|
|
29
|
+
*
|
|
23
30
|
*/
|
|
24
|
-
declare function uniq<T, F extends (value: T) => any, K extends keyof T>(array: T[], iteratee?: F | K): T[];
|
|
31
|
+
declare function uniq<T, F extends (value: T) => any, K extends keyof T>(array: T[], iteratee?: F | K, strickCheck?: boolean): T[];
|
|
25
32
|
export default uniq;
|
package/types/xor.d.ts
CHANGED
|
@@ -1,26 +1,33 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 创建一个唯一值的数组(并集-交集),该数组包含 2
|
|
2
|
+
* 创建一个唯一值的数组(并集-交集),该数组包含 2 个数组参数中不相同的元素。如果传入迭代函数,会调用数组的每个元素以产生唯一性计算的标准。
|
|
3
3
|
*
|
|
4
4
|
* `iteratee` 调用时会传入 1 个参数 `value` 。
|
|
5
5
|
*
|
|
6
|
+
* 默认使用了 [`SameValueZero`](https://tc39.es/ecma262/#sec-samevaluezero) 做等值比较。如果 `strictCheck=true` 将使用 [`SameValue`](https://tc39.es/ecma262/#sec-samevalue) 做等值比较。
|
|
7
|
+
*
|
|
6
8
|
* @static
|
|
7
9
|
* @alias module:Array.xor
|
|
8
10
|
* @since 1.0.0
|
|
9
11
|
* @param {Array} array 要检查的数组。
|
|
10
12
|
* @param {Array} [other=[]] 另一个要检查的数组。
|
|
11
13
|
* @param {Function | string} [iteratee] 迭代函数,调用每个元素。
|
|
14
|
+
* @param {boolean} [strictCheck=false] 严格比较,区分 `+0` `-0`。
|
|
12
15
|
* @returns {Array} 过滤值后的新数组。
|
|
13
16
|
* @example
|
|
14
17
|
*
|
|
15
|
-
*
|
|
18
|
+
* xor([2, 1, 1], [4, 2]); // [1, 4]
|
|
16
19
|
*
|
|
17
|
-
*
|
|
20
|
+
* xor([2.1, 1.2], [4.3, 2.4], Math.floor); // [1.2, 4.3]
|
|
18
21
|
*
|
|
19
|
-
*
|
|
22
|
+
* xor([{x: 1}, {x: 1}, {x: 2}, {x: 2}], [{x: 1}], item=>item.x); // [{x: 2}]
|
|
20
23
|
*
|
|
21
24
|
* // 迭代函数可以直接写入属性。
|
|
22
|
-
*
|
|
25
|
+
* xor([{x: 1}, {x: 1}, {x: 2}, {x: 2}], [{x: 1}], 'x'); // [{x: 2}]
|
|
26
|
+
*
|
|
27
|
+
* xor([-0, 0],[0]); // []
|
|
28
|
+
*
|
|
29
|
+
* xor([-0, 0],[0], undefined, true); // [-0]
|
|
23
30
|
*
|
|
24
31
|
*/
|
|
25
|
-
declare function xor<T, F extends (value: T) => any, K extends keyof T>(array: T[], other?: T[], iteratee?: F | K): T[];
|
|
32
|
+
declare function xor<T, F extends (value: T) => any, K extends keyof T>(array: T[], other?: T[], iteratee?: F | K, strickCheck?: boolean): T[];
|
|
26
33
|
export default xor;
|