UNPKG

ut2

Version:

一个现代 JavaScript 实用工具库。[点击查看在线文档]。

17 lines (16 loc) 679 B
import { ArrayIterator, ArrayLikeIterator, ObjectIterator, StringIterator, WithNullable } from './types'; export interface ForEach { <T>(collection: WithNullable<T[]>, iteratee?: ArrayIterator<T, any>): T[]; (collection: WithNullable<string>, iteratee?: StringIterator<any>): string; <T>(collection: WithNullable<ArrayLike<T>>, iteratee?: ArrayLikeIterator<T, any>): ArrayLike<T>; <T extends object>(collection: WithNullable<T>, iteratee?: ObjectIterator<T, any>): T; } /** * 创建迭代集合方法 * * @private * @param dir 迭代方向 * @returns 迭代集合方法 */ declare function createForEach(dir: 1 | -1): ForEach; export default createForEach;