ut2 1.7.1 → 1.8.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 +138 -134
- package/dist/ut2.js +121 -65
- 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 +4 -3
- package/es/conforms.js +4 -3
- package/es/conformsTo.js +4 -3
- package/es/countBy.js +4 -3
- package/es/curry.js +32 -0
- package/es/defaultTo.js +4 -3
- package/es/every.js +4 -3
- package/es/filter.js +4 -3
- package/es/find.js +4 -3
- package/es/fromPairs.js +4 -3
- package/es/groupBy.js +4 -3
- package/es/index.js +4 -0
- package/es/internals/baseDebounce.js +2 -8
- package/es/internals/createForEach.js +2 -2
- package/es/internals/createReduce.js +2 -2
- package/es/internals/helpers.js +3 -2
- package/es/internals/native.js +2 -1
- package/es/invert.js +22 -0
- package/es/isBigInt.js +8 -0
- package/es/keyBy.js +4 -3
- package/es/map.js +4 -3
- package/es/omit.js +4 -3
- package/es/orderBy.js +4 -3
- package/es/partial.js +16 -11
- package/es/partition.js +4 -3
- package/es/pascalCase.js +11 -0
- package/es/pick.js +4 -3
- package/es/range.js +4 -3
- package/es/some.js +4 -3
- package/es/times.js +4 -3
- package/lib/clamp.js +4 -3
- package/lib/conforms.js +4 -3
- package/lib/conformsTo.js +4 -3
- package/lib/countBy.js +4 -3
- package/lib/curry.js +34 -0
- package/lib/defaultTo.js +4 -3
- package/lib/every.js +4 -3
- package/lib/filter.js +4 -3
- package/lib/find.js +4 -3
- package/lib/fromPairs.js +4 -3
- package/lib/groupBy.js +4 -3
- package/lib/index.js +12 -4
- package/lib/internals/baseDebounce.js +2 -8
- package/lib/internals/createForEach.js +2 -2
- package/lib/internals/createReduce.js +2 -2
- package/lib/internals/helpers.js +2 -1
- package/lib/internals/native.js +1 -0
- package/lib/invert.js +24 -0
- package/lib/isBigInt.js +10 -0
- package/lib/keyBy.js +4 -3
- package/lib/map.js +4 -3
- package/lib/omit.js +4 -3
- package/lib/orderBy.js +4 -3
- package/lib/partial.js +16 -11
- package/lib/partition.js +4 -3
- package/lib/pascalCase.js +13 -0
- package/lib/pick.js +4 -3
- package/lib/range.js +4 -3
- package/lib/some.js +4 -3
- package/lib/times.js +4 -3
- package/package.json +26 -24
- package/types/after.d.ts +2 -1
- package/types/allKeys.d.ts +1 -1
- package/types/allKeysIn.d.ts +1 -1
- package/types/before.d.ts +2 -1
- package/types/clamp.d.ts +29 -2
- package/types/conforms.d.ts +7 -2
- package/types/conformsTo.d.ts +24 -3
- package/types/countBy.d.ts +28 -2
- package/types/curry.d.ts +123 -0
- package/types/debounce.d.ts +2 -1
- package/types/defaultTo.d.ts +6 -3
- package/types/delay.d.ts +2 -1
- package/types/every.d.ts +28 -4
- package/types/filter.d.ts +26 -4
- package/types/find.d.ts +26 -4
- package/types/forEach.d.ts +1 -6
- package/types/forEachRight.d.ts +1 -6
- package/types/fromPairs.d.ts +20 -2
- package/types/groupBy.d.ts +28 -2
- package/types/index.d.ts +4 -0
- package/types/internals/baseDebounce.d.ts +2 -1
- package/types/internals/createForEach.d.ts +7 -6
- package/types/internals/createReduce.d.ts +11 -10
- package/types/internals/helpers.d.ts +1 -0
- package/types/internals/native.d.ts +1 -0
- package/types/internals/types.d.ts +3 -0
- package/types/invert.d.ts +19 -0
- package/types/isBigInt.d.ts +22 -0
- package/types/isFunction.d.ts +2 -1
- package/types/keyBy.d.ts +28 -2
- package/types/keys.d.ts +1 -1
- package/types/keysIn.d.ts +1 -1
- package/types/map.d.ts +28 -4
- package/types/negate.d.ts +2 -1
- package/types/omit.d.ts +6 -1
- package/types/omitBy.d.ts +3 -2
- package/types/once.d.ts +2 -1
- package/types/orderBy.d.ts +43 -2
- package/types/partial.d.ts +63 -11
- package/types/partition.d.ts +38 -2
- package/types/pascalCase.d.ts +27 -0
- package/types/pick.d.ts +6 -1
- package/types/pickBy.d.ts +3 -2
- package/types/range.d.ts +28 -3
- package/types/reduce.d.ts +1 -10
- package/types/reduceRight.d.ts +1 -10
- package/types/some.d.ts +26 -4
- package/types/throttle.d.ts +2 -1
- package/types/times.d.ts +25 -2
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { ArrayIterator, ArrayLikeIterator, ObjectIterator, StringIterator, WithNullable } from './types';
|
|
2
|
+
export interface ForEach {
|
|
3
|
+
<T>(collection: WithNullable<T[]>, iteratee?: ArrayIterator<T, any>): T[];
|
|
4
|
+
(collection: WithNullable<string>, iteratee?: StringIterator<any>): string;
|
|
5
|
+
<T>(collection: WithNullable<ArrayLike<T>>, iteratee?: ArrayLikeIterator<T, any>): ArrayLike<T>;
|
|
6
|
+
<T extends object>(collection: WithNullable<T>, iteratee?: ObjectIterator<T, any>): T;
|
|
7
|
+
}
|
|
2
8
|
/**
|
|
3
9
|
* 创建迭代集合方法
|
|
4
10
|
*
|
|
@@ -6,10 +12,5 @@ import { ArrayIterator, ArrayLikeIterator, ObjectIterator, StringIterator, WithN
|
|
|
6
12
|
* @param dir 迭代方向
|
|
7
13
|
* @returns 迭代集合方法
|
|
8
14
|
*/
|
|
9
|
-
declare function createForEach(dir: 1 | -1):
|
|
10
|
-
<T>(collection: WithNullable<T[]>, iteratee?: ArrayIterator<T, any> | undefined): T[];
|
|
11
|
-
(collection: WithNullable<string>, iteratee?: StringIterator<any>): string;
|
|
12
|
-
<T_1>(collection: WithNullable<ArrayLike<T_1>>, iteratee?: ArrayLikeIterator<T_1, any> | undefined): ArrayLike<T_1>;
|
|
13
|
-
<T_2 extends object>(collection: WithNullable<T_2>, iteratee?: ObjectIterator<T_2, any> | undefined): T_2;
|
|
14
|
-
};
|
|
15
|
+
declare function createForEach(dir: 1 | -1): ForEach;
|
|
15
16
|
export default createForEach;
|
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
import { ReduceArrayIterator, ReduceArrayLikeIterator, ReduceObjectIterator, ReduceStringIterator, WithNullable } from './types';
|
|
2
|
+
export interface Reduce {
|
|
3
|
+
<T, R>(collection: WithNullable<T[]>, iteratee: ReduceArrayIterator<T, R>, initialValue: R): R;
|
|
4
|
+
<R>(collection: WithNullable<string>, iteratee: ReduceStringIterator<R>, initialValue: R): R;
|
|
5
|
+
<T, R>(collection: WithNullable<ArrayLike<T>>, iteratee: ReduceArrayLikeIterator<T, R>, initialValue: R): R;
|
|
6
|
+
<T extends object, R>(collection: WithNullable<T>, iteratee: ReduceObjectIterator<T, R>, initialValue: R): R;
|
|
7
|
+
<T>(collection: WithNullable<T[]>, iteratee?: ReduceArrayIterator<T, T>): T | undefined;
|
|
8
|
+
(collection: WithNullable<string>, iteratee?: ReduceStringIterator<string>): string | undefined;
|
|
9
|
+
<T>(collection: WithNullable<ArrayLike<T>>, iteratee?: ReduceArrayLikeIterator<T, T>): T | undefined;
|
|
10
|
+
<T extends object>(collection: WithNullable<T>, iteratee?: ReduceObjectIterator<T, T[keyof T]>): T[keyof T] | undefined;
|
|
11
|
+
}
|
|
2
12
|
/**
|
|
3
13
|
* 创建 reducer 函数
|
|
4
14
|
*
|
|
@@ -6,14 +16,5 @@ import { ReduceArrayIterator, ReduceArrayLikeIterator, ReduceObjectIterator, Red
|
|
|
6
16
|
* @param dir 迭代方向
|
|
7
17
|
* @returns reduce 方法
|
|
8
18
|
*/
|
|
9
|
-
declare function createReduce(dir: 1 | -1):
|
|
10
|
-
<T, R>(collection: WithNullable<T[]>, iteratee: ReduceArrayIterator<T, R>, initialValue: R): R;
|
|
11
|
-
<R_1>(collection: WithNullable<string>, iteratee: ReduceStringIterator<R_1>, initialValue: R_1): R_1;
|
|
12
|
-
<T_1, R_2>(collection: WithNullable<ArrayLike<T_1>>, iteratee: ReduceArrayLikeIterator<T_1, R_2>, initialValue: R_2): R_2;
|
|
13
|
-
<T_2 extends object, R_3>(collection: WithNullable<T_2>, iteratee: ReduceObjectIterator<T_2, R_3>, initialValue: R_3): R_3;
|
|
14
|
-
<T_3>(collection: WithNullable<T_3[]>, iteratee?: ReduceArrayIterator<T_3, T_3> | undefined): T_3 | undefined;
|
|
15
|
-
(collection: WithNullable<string>, iteratee?: ReduceStringIterator<string>): string | undefined;
|
|
16
|
-
<T_4>(collection: WithNullable<ArrayLike<T_4>>, iteratee?: ReduceArrayLikeIterator<T_4, T_4> | undefined): T_4 | undefined;
|
|
17
|
-
<T_5 extends object>(collection: WithNullable<T_5>, iteratee?: ReduceObjectIterator<T_5, T_5[keyof T_5]> | undefined): T_5[keyof T_5] | undefined;
|
|
18
|
-
};
|
|
19
|
+
declare function createReduce(dir: 1 | -1): Reduce;
|
|
19
20
|
export default createReduce;
|
|
@@ -49,6 +49,7 @@ export declare const MIN_SAFE_INTEGER: number;
|
|
|
49
49
|
* @see {@link https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Array/length | length}
|
|
50
50
|
*/
|
|
51
51
|
export declare const MAX_ARRAY_LENGTH = 4294967295;
|
|
52
|
+
export declare const bigIntTag = "[object BigInt]";
|
|
52
53
|
export declare const numberTag = "[object Number]";
|
|
53
54
|
export declare const booleanTag = "[object Boolean]";
|
|
54
55
|
export declare const stringTag = "[object String]";
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
export type FunctionAny = (...args: any[]) => any;
|
|
1
2
|
/**
|
|
2
3
|
* 工具辅助类型
|
|
3
4
|
*/
|
|
4
5
|
export type Many<T> = T | T[];
|
|
5
6
|
export type WithNullable<T> = T | null | undefined;
|
|
7
|
+
export type PropertyName = string | number | symbol;
|
|
8
|
+
export type ObjectPredicate<T extends object, K extends keyof T = keyof T> = (value: T[K], key: K) => boolean;
|
|
6
9
|
/**
|
|
7
10
|
* 迭代参数
|
|
8
11
|
*/
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ObjectPredicate, PropertyName, WithNullable } from './internals/types';
|
|
2
|
+
/**
|
|
3
|
+
* 创建一个对象,该对象由 `object` 自身可枚举属性(不包含 `Symbol` 属性)和值反转组成。
|
|
4
|
+
*
|
|
5
|
+
* @static
|
|
6
|
+
* @alias module:Object.invert
|
|
7
|
+
* @since 1.8.0
|
|
8
|
+
* @param {Object} object 来源对象。
|
|
9
|
+
* @param {Function} [predicate] 调用每一个属性的函数,返回 `truthy` 表示要反转,否则不反转。
|
|
10
|
+
* @returns {Object} 新对象。
|
|
11
|
+
* @example
|
|
12
|
+
*
|
|
13
|
+
* invert({ a: 1, b: 2 }); // { 1: 'a', 2: 'b' }
|
|
14
|
+
*
|
|
15
|
+
* invert({ a: undefined, b: null }); // { undefined: 'a', null: 'b' }
|
|
16
|
+
*
|
|
17
|
+
*/
|
|
18
|
+
declare function invert<T extends object>(object: WithNullable<T>, predicate?: ObjectPredicate<T>): Record<PropertyName, any>;
|
|
19
|
+
export default invert;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 检查值是否为 bigint 类型或对象。
|
|
3
|
+
*
|
|
4
|
+
* @static
|
|
5
|
+
* @alias module:Language.isBigInt
|
|
6
|
+
* @since 1.8.0
|
|
7
|
+
* @param {*} value 要检查的值。
|
|
8
|
+
* @returns {boolean} 如果值为 bigint 类型或对象,返回 `true` 否则返回 `false` 。
|
|
9
|
+
* @example
|
|
10
|
+
*
|
|
11
|
+
* isBigInt(0n); // true
|
|
12
|
+
*
|
|
13
|
+
* isBigInt(1n); // true
|
|
14
|
+
*
|
|
15
|
+
* isBigInt(BigInt(1)); // true
|
|
16
|
+
*
|
|
17
|
+
* isBigInt(Object(1n)); // true
|
|
18
|
+
*
|
|
19
|
+
* isBigInt(1); // false
|
|
20
|
+
*/
|
|
21
|
+
declare function isBigInt(value: any): value is bigint;
|
|
22
|
+
export default isBigInt;
|
package/types/isFunction.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { FunctionAny } from './internals/types';
|
|
1
2
|
/**
|
|
2
3
|
* 检查值是否为 `Function` 对象 。
|
|
3
4
|
*
|
|
@@ -15,5 +16,5 @@
|
|
|
15
16
|
* isFunction(/x/); // false
|
|
16
17
|
*
|
|
17
18
|
*/
|
|
18
|
-
declare function isFunction(value: any): value is
|
|
19
|
+
declare function isFunction(value: any): value is FunctionAny;
|
|
19
20
|
export default isFunction;
|
package/types/keyBy.d.ts
CHANGED
|
@@ -1,4 +1,30 @@
|
|
|
1
1
|
import { CollectionList, CollectionObject, IterateeParam } from './internals/types';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
interface KeyBy {
|
|
3
|
+
<T>(collection: CollectionList<T>, iteratee?: IterateeParam<T>): Record<string, T>;
|
|
4
|
+
<T extends object, V extends T[keyof T]>(collection: CollectionObject<T>, iteratee?: IterateeParam<V>): Record<string, V>;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* 创建一个组成聚合对象, `key` 是经过 `iteratee` 执行处理 `collection` 中每个元素后返回的结果。每个 `key` 对应的值是生成 `key` 的最后一个元素。
|
|
8
|
+
*
|
|
9
|
+
* `iteratee` 调用时会传入 1 个参数 `value` 。
|
|
10
|
+
*
|
|
11
|
+
* @function
|
|
12
|
+
* @alias module:Collection.keyBy
|
|
13
|
+
* @since 1.0.0
|
|
14
|
+
* @param {ArrayLike<any> | Object} collection 一个用来迭代的集合。
|
|
15
|
+
* @param {Function | string} [iteratee=identity] 迭代函数,用来转换键。
|
|
16
|
+
* @returns {Object} 组成聚合对象。
|
|
17
|
+
* @example
|
|
18
|
+
*
|
|
19
|
+
* keyBy([6, 4, 6]); // {'6': 6, '4': 4}
|
|
20
|
+
*
|
|
21
|
+
* keyBy([6.1, 4.2, 6.3], Math.floor); // {'6': 6.3, '4': 4.2}
|
|
22
|
+
*
|
|
23
|
+
* keyBy([{n: 6.1}, {n: 4.2}, {n: 6.3}], item=>Math.floor(item.n)); // {'6': {n: 6.3}, '4': {n: 4.2}}
|
|
24
|
+
*
|
|
25
|
+
* // 迭代函数可以直接写入属性。
|
|
26
|
+
* keyBy(['one', 'two', 'three'], 'length'); // {'3': 'two', '5': 'three'}
|
|
27
|
+
*
|
|
28
|
+
*/
|
|
29
|
+
declare const keyBy: KeyBy;
|
|
4
30
|
export default keyBy;
|
package/types/keys.d.ts
CHANGED
package/types/keysIn.d.ts
CHANGED
package/types/map.d.ts
CHANGED
|
@@ -1,6 +1,30 @@
|
|
|
1
1
|
import { ArrayIterator, ArrayLikeIterator, ObjectIterator, StringIterator, WithNullable } from './internals/types';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
interface Map {
|
|
3
|
+
<T>(collection: WithNullable<T[]>, iteratee?: ArrayIterator<T, any>): T[];
|
|
4
|
+
(collection: WithNullable<string>, iteratee?: StringIterator<any>): string[];
|
|
5
|
+
<T>(collection: WithNullable<ArrayLike<T>>, iteratee?: ArrayLikeIterator<T, any>): T[];
|
|
6
|
+
<T extends object>(collection: WithNullable<T>, iteratee?: ObjectIterator<T, any>): Array<T[keyof T]>;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* 创建一个新数组,这个数组的值由迭代集合每个元素调用 `iteratee` 函数的返回值组成。
|
|
10
|
+
*
|
|
11
|
+
* `iteratee` 调用时会传入三个参数 `value` `index|key` `collection` 。
|
|
12
|
+
*
|
|
13
|
+
* @static
|
|
14
|
+
* @alias module:Collection.map
|
|
15
|
+
* @since 1.7.0
|
|
16
|
+
* @param {ArrayLike<any> | Object} collection 要迭代的集合。
|
|
17
|
+
* @param {function} [iteratee=identity] 每次迭代调用的函数。
|
|
18
|
+
* @returns {Array} 一个新数组。
|
|
19
|
+
* @example
|
|
20
|
+
*
|
|
21
|
+
* const arr = [1, 2, 3];
|
|
22
|
+
* map(arr, item => item * 3); // [3, 6, 9]
|
|
23
|
+
*
|
|
24
|
+
* const obj = { one: 1, two: 2, three: 3 };
|
|
25
|
+
* map(obj, item => item * 3); // [3, 6, 9]
|
|
26
|
+
*
|
|
27
|
+
* map([[1, 2], [3, 4]], item=>item[0]); // [1, 3]
|
|
28
|
+
*/
|
|
29
|
+
declare const map: Map;
|
|
6
30
|
export default map;
|
package/types/negate.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { FunctionAny } from './internals/types';
|
|
1
2
|
/**
|
|
2
3
|
* 创建一个断言函数结果取反的函数。
|
|
3
4
|
*
|
|
@@ -19,5 +20,5 @@
|
|
|
19
20
|
* nums.filter(ne); // [1, 3, 5]
|
|
20
21
|
*
|
|
21
22
|
*/
|
|
22
|
-
declare function negate<T extends
|
|
23
|
+
declare function negate<T extends FunctionAny>(this: any, predicate: T): (...args: Parameters<T>) => boolean;
|
|
23
24
|
export default negate;
|
package/types/omit.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import { PropertyName, WithNullable } from './internals/types';
|
|
2
|
+
interface OmitFunction {
|
|
3
|
+
<T extends object, K extends keyof T>(object: WithNullable<T>, fields?: K | K[]): Omit<T, K>;
|
|
4
|
+
<T extends object, K extends PropertyName>(object: WithNullable<T>, fields?: K | K[]): Omit<T, K>;
|
|
5
|
+
}
|
|
1
6
|
/**
|
|
2
7
|
* 创建一个对象,该对象由忽略属性之外的 `object` 自身和继承的可枚举属性组成。与 [`pick`](#.pick) 相反。
|
|
3
8
|
*
|
|
@@ -21,5 +26,5 @@
|
|
|
21
26
|
* omit(obj, ['name', 'age']); // {}
|
|
22
27
|
*
|
|
23
28
|
*/
|
|
24
|
-
declare
|
|
29
|
+
declare const omit: OmitFunction;
|
|
25
30
|
export default omit;
|
package/types/omitBy.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ObjectPredicate, WithNullable } from './internals/types';
|
|
1
2
|
/**
|
|
2
3
|
* 创建一个对象,该对象忽略 `predicate` (断言函数)判断不是真值的属性后,`object` 自身和继承的可枚举属性组成。与 [`pickBy`](#.pickBy) 相反。
|
|
3
4
|
*
|
|
@@ -7,7 +8,7 @@
|
|
|
7
8
|
* @alias module:Object.omitBy
|
|
8
9
|
* @since 1.0.0
|
|
9
10
|
* @param {Object} object 来源对象。
|
|
10
|
-
* @param {Function} [predicate]
|
|
11
|
+
* @param {Function} [predicate] 调用每一个属性的函数,返回 `truthy` 表示要忽略该属性,否则不忽略。
|
|
11
12
|
* @returns {Object} 新对象。
|
|
12
13
|
* @example
|
|
13
14
|
*
|
|
@@ -20,5 +21,5 @@
|
|
|
20
21
|
* omitBy(obj, (value) => value); // {}
|
|
21
22
|
*
|
|
22
23
|
*/
|
|
23
|
-
declare function omitBy<T extends object>(object: T
|
|
24
|
+
declare function omitBy<T extends object>(object: WithNullable<T>, predicate?: ObjectPredicate<T>): Partial<T>;
|
|
24
25
|
export default omitBy;
|
package/types/once.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { FunctionAny } from './internals/types';
|
|
1
2
|
/**
|
|
2
3
|
* 创建一个只能调用 `func` 一次的函数。重复调用将返回第一次调用 `func` 的结果。
|
|
3
4
|
*
|
|
@@ -20,5 +21,5 @@
|
|
|
20
21
|
* increment(); // 1
|
|
21
22
|
*
|
|
22
23
|
*/
|
|
23
|
-
declare function once<T extends
|
|
24
|
+
declare function once<T extends FunctionAny>(func: T): T;
|
|
24
25
|
export default once;
|
package/types/orderBy.d.ts
CHANGED
|
@@ -1,5 +1,46 @@
|
|
|
1
1
|
import { Order } from './internals/compare';
|
|
2
2
|
import { CollectionList, CollectionObject, IterateeParam, Many } from './internals/types';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
interface OrderBy {
|
|
4
|
+
<T>(collection: CollectionList<T>, iteratee?: Many<IterateeParam<T>>, orders?: Many<Order>): T[];
|
|
5
|
+
<T extends object, V extends T[keyof T]>(collection: CollectionObject<T>, iteratee?: Many<IterateeParam<V>>, orders?: Many<Order>): V[];
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* 创建一个元素数组,以迭代函数处理的结果排序。如果没有指定排序,默认为升序排序。
|
|
9
|
+
*
|
|
10
|
+
* `asc` 升序, `desc` 降序,默认执行稳定排序,也就是说相同元素会保持原始排序。
|
|
11
|
+
*
|
|
12
|
+
* `iteratee` 调用时会传入 1 个参数 `value` 。
|
|
13
|
+
*
|
|
14
|
+
* @function
|
|
15
|
+
* @alias module:Collection.orderBy
|
|
16
|
+
* @since 1.0.0
|
|
17
|
+
* @see {@link https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Array/sort | sort}
|
|
18
|
+
* @param {ArrayLike<any> | Object} collection 一个用来迭代的集合。
|
|
19
|
+
* @param {Function | string | Array} [iteratees] 排序的迭代函数。
|
|
20
|
+
* @param {'asc' | 'desc' | Array} [orders] 迭代函数的排序顺序。
|
|
21
|
+
* @returns {Array} 排序后的新数组。
|
|
22
|
+
* @example
|
|
23
|
+
*
|
|
24
|
+
* const array = [2, 1, 3, 5, 4];
|
|
25
|
+
*
|
|
26
|
+
* orderBy(array);; // [1, 2, 3, 4, 5]
|
|
27
|
+
*
|
|
28
|
+
* orderBy(array, item=>item, 'desc');; // [5, 4, 3, 2, 1]
|
|
29
|
+
*
|
|
30
|
+
* const objects = [
|
|
31
|
+
* { a: 'x', b: 3 },
|
|
32
|
+
* { a: 'y', b: 4 },
|
|
33
|
+
* { a: 'x', b: 1 },
|
|
34
|
+
* { a: 'y', b: 2 }
|
|
35
|
+
* ];
|
|
36
|
+
*
|
|
37
|
+
* orderBy(objects, 'b');
|
|
38
|
+
* // [{ a: 'x', b: 1 },{ a: 'y', b: 2 },{ a: 'x', b: 3 },{ a: 'y', b: 4 }]
|
|
39
|
+
*
|
|
40
|
+
* // 迭代函数可以直接写入属性。
|
|
41
|
+
* orderBy(objects, ['a', 'b'], ['asc', 'desc']);
|
|
42
|
+
* // [{ a: 'x', b: 3 },{ a: 'x', b: 1 },{ a: 'y', b: 4 },{ a: 'y', b: 2 }]
|
|
43
|
+
*
|
|
44
|
+
*/
|
|
45
|
+
declare const orderBy: OrderBy;
|
|
5
46
|
export default orderBy;
|
package/types/partial.d.ts
CHANGED
|
@@ -1,12 +1,64 @@
|
|
|
1
|
-
declare
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
declare const PLACEHOLDER: {
|
|
2
|
+
__ut2_partial_ph__: null;
|
|
3
|
+
};
|
|
4
|
+
type Placeholder = typeof PLACEHOLDER;
|
|
5
|
+
type Function0<R> = () => R;
|
|
6
|
+
type Function1<T1, R> = (t1: T1) => R;
|
|
7
|
+
type Function2<T1, T2, R> = (t1: T1, t2: T2) => R;
|
|
8
|
+
type Function3<T1, T2, T3, R> = (t1: T1, t2: T2, t3: T3) => R;
|
|
9
|
+
type Function4<T1, T2, T3, T4, R> = (t1: T1, t2: T2, t3: T3, t4: T4) => R;
|
|
10
|
+
interface Partial {
|
|
11
|
+
<T1, T2, R>(func: Function2<T1, T2, R>, plc1: Placeholder, arg2: T2): Function1<T1, R>;
|
|
12
|
+
<T1, T2, R>(func: Function2<T1, T2, R>, arg1: T1, arg2: T2): Function0<R>;
|
|
13
|
+
<T1, T2, T3, R>(func: Function3<T1, T2, T3, R>, plc1: Placeholder, arg2: T2): Function2<T1, T3, R>;
|
|
14
|
+
<T1, T2, T3, R>(func: Function3<T1, T2, T3, R>, plc1: Placeholder, plc2: Placeholder, arg3: T3): Function2<T1, T2, R>;
|
|
15
|
+
<T1, T2, T3, R>(func: Function3<T1, T2, T3, R>, arg1: T1, plc2: Placeholder, arg3: T3): Function1<T2, R>;
|
|
16
|
+
<T1, T2, T3, R>(func: Function3<T1, T2, T3, R>, plc1: Placeholder, arg2: T2, arg3: T3): Function1<T1, R>;
|
|
17
|
+
<T1, T2, T3, R>(func: Function3<T1, T2, T3, R>, arg1: T1, arg2: T2, arg3: T3): Function0<R>;
|
|
18
|
+
<T1, T2, T3, T4, R>(func: Function4<T1, T2, T3, T4, R>, plc1: Placeholder, arg2: T2): Function3<T1, T3, T4, R>;
|
|
19
|
+
<T1, T2, T3, T4, R>(func: Function4<T1, T2, T3, T4, R>, plc1: Placeholder, plc2: Placeholder, arg3: T3): Function3<T1, T2, T4, R>;
|
|
20
|
+
<T1, T2, T3, T4, R>(func: Function4<T1, T2, T3, T4, R>, arg1: T1, plc2: Placeholder, arg3: T3): Function2<T2, T4, R>;
|
|
21
|
+
<T1, T2, T3, T4, R>(func: Function4<T1, T2, T3, T4, R>, plc1: Placeholder, arg2: T2, arg3: T3): Function2<T1, T4, R>;
|
|
22
|
+
<T1, T2, T3, T4, R>(func: Function4<T1, T2, T3, T4, R>, arg1: T1, arg2: T2, arg3: T3): Function1<T4, R>;
|
|
23
|
+
<T1, T2, T3, T4, R>(func: Function4<T1, T2, T3, T4, R>, plc1: Placeholder, plc2: Placeholder, plc3: Placeholder, arg4: T4): Function3<T1, T2, T3, R>;
|
|
24
|
+
<T1, T2, T3, T4, R>(func: Function4<T1, T2, T3, T4, R>, arg1: T1, plc2: Placeholder, plc3: Placeholder, arg4: T4): Function2<T2, T3, R>;
|
|
25
|
+
<T1, T2, T3, T4, R>(func: Function4<T1, T2, T3, T4, R>, plc1: Placeholder, arg2: T2, plc3: Placeholder, arg4: T4): Function2<T1, T3, R>;
|
|
26
|
+
<T1, T2, T3, T4, R>(func: Function4<T1, T2, T3, T4, R>, arg1: T1, arg2: T2, plc3: Placeholder, arg4: T4): Function1<T3, R>;
|
|
27
|
+
<T1, T2, T3, T4, R>(func: Function4<T1, T2, T3, T4, R>, plc1: Placeholder, plc2: Placeholder, arg3: T3, arg4: T4): Function2<T1, T2, R>;
|
|
28
|
+
<T1, T2, T3, T4, R>(func: Function4<T1, T2, T3, T4, R>, arg1: T1, plc2: Placeholder, arg3: T3, arg4: T4): Function1<T2, R>;
|
|
29
|
+
<T1, T2, T3, T4, R>(func: Function4<T1, T2, T3, T4, R>, plc1: Placeholder, arg2: T2, arg3: T3, arg4: T4): Function1<T1, R>;
|
|
30
|
+
<T1, T2, T3, T4, R>(func: Function4<T1, T2, T3, T4, R>, arg1: T1, arg2: T2, arg3: T3, arg4: T4): Function0<R>;
|
|
31
|
+
<TS extends any[], R>(func: (...ts: TS) => R): (...ts: TS) => R;
|
|
32
|
+
<TS extends any[], T1, R>(func: (t1: T1, ...ts: TS) => R, arg1: T1): (...ts: TS) => R;
|
|
33
|
+
<TS extends any[], T1, T2, R>(func: (t1: T1, t2: T2, ...ts: TS) => R, t1: T1, t2: T2): (...ts: TS) => R;
|
|
34
|
+
<TS extends any[], T1, T2, T3, R>(func: (t1: T1, t2: T2, t3: T3, ...ts: TS) => R, t1: T1, t2: T2, t3: T3): (...ts: TS) => R;
|
|
35
|
+
<TS extends any[], T1, T2, T3, T4, R>(func: (t1: T1, t2: T2, t3: T3, t4: T4, ...ts: TS) => R, t1: T1, t2: T2, t3: T3, t4: T4): (...ts: TS) => R;
|
|
36
|
+
placeholder: Placeholder;
|
|
37
|
+
_: Placeholder;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* 创建一个函数。该函数调用 `func` ,并传入预设的 `args` 参数。
|
|
41
|
+
*
|
|
42
|
+
* `partial._` 或 `partial.placeholder` 可用作参数的占位符。
|
|
43
|
+
*
|
|
44
|
+
* @function
|
|
45
|
+
* @alias module:Function.partial
|
|
46
|
+
* @since 1.0.0
|
|
47
|
+
* @param {Function} func 需要预设的函数。
|
|
48
|
+
* @param {...*} [args] 预设的参数。
|
|
49
|
+
* @returns {Function} 预设参数的函数。
|
|
50
|
+
* @example
|
|
51
|
+
*
|
|
52
|
+
* function greet(greeting, name){
|
|
53
|
+
* return greeting + ' ' + name;
|
|
54
|
+
* }
|
|
55
|
+
*
|
|
56
|
+
* const sayHelloTo = partial(greet, 'hello');
|
|
57
|
+
* sayHelloTo('jeff'); // 'hello jeff'
|
|
58
|
+
*
|
|
59
|
+
* const greetJeff = partial(greet, partial._, 'jeff');
|
|
60
|
+
* greetJeff('hi'); // 'hi jeff'
|
|
61
|
+
*
|
|
62
|
+
*/
|
|
63
|
+
declare const partial: Partial;
|
|
12
64
|
export default partial;
|
package/types/partition.d.ts
CHANGED
|
@@ -1,4 +1,40 @@
|
|
|
1
1
|
import { CollectionList, CollectionObject, IterateeParam } from './internals/types';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
interface Partition {
|
|
3
|
+
<T>(collection: CollectionList<T>, iteratee?: IterateeParam<T>): [T[], T[]];
|
|
4
|
+
<T extends object, V extends T[keyof T]>(collection: CollectionObject<T>, iteratee?: IterateeParam<V>): [V[], V[]];
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* 创建一个分成两组的元素数组,第一组包含 `predicate`(断言函数)返回为 [`truthy`](https://developer.mozilla.org/zh-CN/docs/Glossary/Truthy)(真值)的元素,第二组包含 `predicate`(断言函数)返回为 [`falsy`](https://developer.mozilla.org/zh-CN/docs/Glossary/Falsy)(假值)的元素。
|
|
8
|
+
*
|
|
9
|
+
* `predicate` 调用时会传入 1 个参数 `value`。
|
|
10
|
+
*
|
|
11
|
+
* @static
|
|
12
|
+
* @alias module:Collection.partition
|
|
13
|
+
* @since 1.0.0
|
|
14
|
+
* @param {ArrayLike<any> | Object} collection 一个用来迭代的集合。
|
|
15
|
+
* @param {Function | string} [predicate=identity] 每次迭代调用的断言函数。
|
|
16
|
+
* @returns {Array} 分组后的数组。
|
|
17
|
+
* @example
|
|
18
|
+
*
|
|
19
|
+
* const users = [
|
|
20
|
+
* { user: 'barney', age: 36, active: false },
|
|
21
|
+
* { user: 'fred', age: 40, active: true },
|
|
22
|
+
* { user: 'pebbles', age: 1, active: false }
|
|
23
|
+
* ];
|
|
24
|
+
*
|
|
25
|
+
* partition(users, item => item.active);
|
|
26
|
+
* // [
|
|
27
|
+
* // [{ user: 'fred', age: 40, active: true }],
|
|
28
|
+
* // [{ user: 'barney', age: 36, active: false }, { user: 'pebbles', age: 1, active: false }]
|
|
29
|
+
* // ]
|
|
30
|
+
*
|
|
31
|
+
* // 迭代函数可以直接写入属性。
|
|
32
|
+
* partition(users, 'active');
|
|
33
|
+
* // [
|
|
34
|
+
* // [{ user: 'fred', age: 40, active: true }],
|
|
35
|
+
* // [{ user: 'barney', age: 36, active: false }, { user: 'pebbles', age: 1, active: false }]
|
|
36
|
+
* // ]
|
|
37
|
+
*
|
|
38
|
+
*/
|
|
39
|
+
declare const partition: Partition;
|
|
4
40
|
export default partition;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 转换字符串为帕斯卡写法。又名为大驼峰写法。
|
|
3
|
+
*
|
|
4
|
+
* @static
|
|
5
|
+
* @alias module:String.pascalCase
|
|
6
|
+
* @since 1.8.0
|
|
7
|
+
* @see {@link https://en.wikipedia.org/wiki/Camel_case | Camel_case}
|
|
8
|
+
* @param {string} string 要转换的字符串。
|
|
9
|
+
* @param {RegExp | string} [pattern] 拆分词组的匹配模式。
|
|
10
|
+
* @returns {string} 帕斯卡写法的字符串。
|
|
11
|
+
* @example
|
|
12
|
+
*
|
|
13
|
+
* pascalCase('foo bar'); // 'FooBar'
|
|
14
|
+
*
|
|
15
|
+
* pascalCase('foo-bar'); // 'FooBar'
|
|
16
|
+
*
|
|
17
|
+
* pascalCase('Foo Bar'); // 'FooBar'
|
|
18
|
+
*
|
|
19
|
+
* pascalCase('FOO BAR'); // 'FooBar'
|
|
20
|
+
*
|
|
21
|
+
* pascalCase('--FOO-BAR--'); // 'FooBar'
|
|
22
|
+
*
|
|
23
|
+
* pascalCase('__FOO_BAR__'); // 'FooBar'
|
|
24
|
+
*
|
|
25
|
+
*/
|
|
26
|
+
declare function pascalCase(string: string, pattern?: RegExp | string): string;
|
|
27
|
+
export default pascalCase;
|
package/types/pick.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import { PropertyName, WithNullable } from './internals/types';
|
|
2
|
+
interface PickFunction {
|
|
3
|
+
<T extends object, K extends keyof T>(object: WithNullable<T>, fields?: K | K[]): Pick<T, K>;
|
|
4
|
+
<T extends object, K extends PropertyName>(object: WithNullable<T>, fields?: K | K[]): Record<PropertyName, any>;
|
|
5
|
+
}
|
|
1
6
|
/**
|
|
2
7
|
* 创建一个从 `object` 选中的属性的对象。
|
|
3
8
|
*
|
|
@@ -21,5 +26,5 @@
|
|
|
21
26
|
* // 选取多个属性
|
|
22
27
|
* pick(obj, ['name', 'age']); // { name: "jeff", age: 18 }
|
|
23
28
|
*/
|
|
24
|
-
declare
|
|
29
|
+
declare const pick: PickFunction;
|
|
25
30
|
export default pick;
|
package/types/pickBy.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ObjectPredicate, WithNullable } from './internals/types';
|
|
1
2
|
/**
|
|
2
3
|
* 创建一个对象,该对象的属性从 `object` 中经 `predicate` (断言函数)判断为真值的属性。
|
|
3
4
|
*
|
|
@@ -7,7 +8,7 @@
|
|
|
7
8
|
* @alias module:Object.pickBy
|
|
8
9
|
* @since 1.0.0
|
|
9
10
|
* @param {Object} obj 来源对象。
|
|
10
|
-
* @param {Function} [predicate]
|
|
11
|
+
* @param {Function} [predicate] 调用每一个属性的函数,返回 `truthy` 表示要提取该属性,否则不提取。
|
|
11
12
|
* @returns {Object} 新对象。
|
|
12
13
|
* @example
|
|
13
14
|
*
|
|
@@ -20,5 +21,5 @@
|
|
|
20
21
|
* pickBy(obj, (value) => value); // { name: "jeff", age: 18 }
|
|
21
22
|
*
|
|
22
23
|
*/
|
|
23
|
-
declare function pickBy<T extends object>(object: T
|
|
24
|
+
declare function pickBy<T extends object>(object: WithNullable<T>, predicate?: ObjectPredicate<T>): Partial<T>;
|
|
24
25
|
export default pickBy;
|
package/types/range.d.ts
CHANGED
|
@@ -1,4 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
interface Range {
|
|
2
|
+
(start: number, end: number, step: number): number[];
|
|
3
|
+
(start: number, end: number): number[];
|
|
4
|
+
(end: number): number[];
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* 创建一个升序或降序的数字数组。
|
|
8
|
+
*
|
|
9
|
+
* 如果省略 `start` 默认为 0 。
|
|
10
|
+
*
|
|
11
|
+
* @function
|
|
12
|
+
* @alias module:Util.range
|
|
13
|
+
* @since 1.6.0
|
|
14
|
+
* @param {number} [start=0] 开始值。
|
|
15
|
+
* @param {number} end 结束值。
|
|
16
|
+
* @param {number} [step] 要增加或减少的值。如果值为 `0` ,将视为无效参数。如果 `start` 在 `end` 之前,默认为 1 ,否则默认为 -1。
|
|
17
|
+
* @return {number[]} 从开始值(包含)到结束值(不包含)逐步递增或递减的数字数组。
|
|
18
|
+
* @example
|
|
19
|
+
*
|
|
20
|
+
* range(4); // [0, 1, 2, 3]
|
|
21
|
+
* range(-4); // [0, -1, -2, -3]
|
|
22
|
+
* range(1, 5); // [1, 2, 3, 4]
|
|
23
|
+
* range(0, 20, 5); // [0, 5, 10, 15]
|
|
24
|
+
* range(0, -4, -1); // [1, 2, 3]
|
|
25
|
+
* range(1, 4, 0); // [1, 2, 3]
|
|
26
|
+
* range(0); // []
|
|
27
|
+
*/
|
|
28
|
+
declare const range: Range;
|
|
4
29
|
export default range;
|
package/types/reduce.d.ts
CHANGED
|
@@ -25,14 +25,5 @@
|
|
|
25
25
|
* // 6
|
|
26
26
|
*
|
|
27
27
|
*/
|
|
28
|
-
declare const reduce:
|
|
29
|
-
<T, R>(collection: import("./internals/types").WithNullable<T[]>, iteratee: import("./internals/types").ReduceArrayIterator<T, R>, initialValue: R): R;
|
|
30
|
-
<R_1>(collection: import("./internals/types").WithNullable<string>, iteratee: import("./internals/types").ReduceStringIterator<R_1>, initialValue: R_1): R_1;
|
|
31
|
-
<T_1, R_2>(collection: import("./internals/types").WithNullable<ArrayLike<T_1>>, iteratee: import("./internals/types").ReduceArrayLikeIterator<T_1, R_2>, initialValue: R_2): R_2;
|
|
32
|
-
<T_2 extends object, R_3>(collection: import("./internals/types").WithNullable<T_2>, iteratee: import("./internals/types").ReduceObjectIterator<T_2, R_3>, initialValue: R_3): R_3;
|
|
33
|
-
<T_3>(collection: import("./internals/types").WithNullable<T_3[]>, iteratee?: import("./internals/types").ReduceArrayIterator<T_3, T_3> | undefined): T_3 | undefined;
|
|
34
|
-
(collection: import("./internals/types").WithNullable<string>, iteratee?: import("./internals/types").ReduceStringIterator<string> | undefined): string | undefined;
|
|
35
|
-
<T_4>(collection: import("./internals/types").WithNullable<ArrayLike<T_4>>, iteratee?: import("./internals/types").ReduceArrayLikeIterator<T_4, T_4> | undefined): T_4 | undefined;
|
|
36
|
-
<T_5 extends object>(collection: import("./internals/types").WithNullable<T_5>, iteratee?: import("./internals/types").ReduceObjectIterator<T_5, T_5[keyof T_5]> | undefined): T_5[keyof T_5] | undefined;
|
|
37
|
-
};
|
|
28
|
+
declare const reduce: import("./internals/createReduce").Reduce;
|
|
38
29
|
export default reduce;
|
package/types/reduceRight.d.ts
CHANGED
|
@@ -25,14 +25,5 @@
|
|
|
25
25
|
* // 6
|
|
26
26
|
*
|
|
27
27
|
*/
|
|
28
|
-
declare const reduceRight:
|
|
29
|
-
<T, R>(collection: import("./internals/types").WithNullable<T[]>, iteratee: import("./internals/types").ReduceArrayIterator<T, R>, initialValue: R): R;
|
|
30
|
-
<R_1>(collection: import("./internals/types").WithNullable<string>, iteratee: import("./internals/types").ReduceStringIterator<R_1>, initialValue: R_1): R_1;
|
|
31
|
-
<T_1, R_2>(collection: import("./internals/types").WithNullable<ArrayLike<T_1>>, iteratee: import("./internals/types").ReduceArrayLikeIterator<T_1, R_2>, initialValue: R_2): R_2;
|
|
32
|
-
<T_2 extends object, R_3>(collection: import("./internals/types").WithNullable<T_2>, iteratee: import("./internals/types").ReduceObjectIterator<T_2, R_3>, initialValue: R_3): R_3;
|
|
33
|
-
<T_3>(collection: import("./internals/types").WithNullable<T_3[]>, iteratee?: import("./internals/types").ReduceArrayIterator<T_3, T_3> | undefined): T_3 | undefined;
|
|
34
|
-
(collection: import("./internals/types").WithNullable<string>, iteratee?: import("./internals/types").ReduceStringIterator<string> | undefined): string | undefined;
|
|
35
|
-
<T_4>(collection: import("./internals/types").WithNullable<ArrayLike<T_4>>, iteratee?: import("./internals/types").ReduceArrayLikeIterator<T_4, T_4> | undefined): T_4 | undefined;
|
|
36
|
-
<T_5 extends object>(collection: import("./internals/types").WithNullable<T_5>, iteratee?: import("./internals/types").ReduceObjectIterator<T_5, T_5[keyof T_5]> | undefined): T_5[keyof T_5] | undefined;
|
|
37
|
-
};
|
|
28
|
+
declare const reduceRight: import("./internals/createReduce").Reduce;
|
|
38
29
|
export default reduceRight;
|
package/types/some.d.ts
CHANGED
|
@@ -1,6 +1,28 @@
|
|
|
1
1
|
import { ArrayIterator, ArrayLikeIterator, ObjectIterator, StringIterator, WithNullable } from './internals/types';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
interface Some {
|
|
3
|
+
<T>(collection: WithNullable<T[]>, predicate?: ArrayIterator<T, any>): boolean;
|
|
4
|
+
(collection: WithNullable<string>, predicate?: StringIterator<any>): boolean;
|
|
5
|
+
<T>(collection: WithNullable<ArrayLike<T>>, predicate?: ArrayLikeIterator<T, any>): boolean;
|
|
6
|
+
<T extends object>(collection: WithNullable<T>, predicate?: ObjectIterator<T, any>): boolean;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* 迭代集合中的元素执行 `predicate` 函数,如果任一元素通过 `predicate` 返回真值,则停止迭代并返回 `true` ,否则返回 `false` 。
|
|
10
|
+
*
|
|
11
|
+
* `predicate` 调用时会传入三个参数 `value` `index|key` `collection` 。
|
|
12
|
+
*
|
|
13
|
+
* @function
|
|
14
|
+
* @alias module:Collection.some
|
|
15
|
+
* @since 1.7.0
|
|
16
|
+
* @param {ArrayLike<any> | Object} collection 要迭代的集合。
|
|
17
|
+
* @param {function} [predicate=identity] 每次迭代调用的函数。
|
|
18
|
+
* @returns {boolean} 如果任一元素通过 `predicate` 测试,则返回 `true` ,否则返回 `false` 。
|
|
19
|
+
* @example
|
|
20
|
+
*
|
|
21
|
+
* const arr = [1, 2, 3, 4, 5, 6];
|
|
22
|
+
* some(arr, item => item % 2 === 0); // false
|
|
23
|
+
*
|
|
24
|
+
* const obj = { one: 1, two: 2, three: 3 };
|
|
25
|
+
* some(obj, item => item > 1); // true
|
|
26
|
+
*/
|
|
27
|
+
declare const some: Some;
|
|
6
28
|
export default some;
|