forked from leebyron/iterall
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
35 lines (24 loc) · 1.46 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/**
* Copyright (c) 2016, Lee Byron
* All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
declare module "iterall" {
// Note: TypeScript already has built-in definitions for
// Iterable<TValue> and Iterator<TValue> so they are not defined here.
export var $$iterator: symbol | string
export function isIterable(obj: any): boolean
export function isArrayLike(obj: any): boolean
export function isCollection(obj: any): boolean
export function getIterator<TValue>(iterable: Iterable<TValue>): Iterator<TValue>
export function getIterator(iterable: any): void | Iterator<any>
export function getIteratorMethod<TValue>(iterable: Iterable<TValue>): () => Iterator<TValue>
export function getIteratorMethod(iterable: any): () => Iterator<any> | void
export function forEach<TValue, TCollection extends Iterable<TValue>>(collection: TCollection, callbackFn: (value: TValue, index: number, collection: TCollection) => any, thisArg?: any): void
export function forEach<TCollection extends { length: number }>(collection: TCollection, callbackFn: (value: any, index: number, collection: TCollection) => any, thisArg?: any): void
export function createIterator<TValue>(collection: Iterable<TValue>): Iterator<TValue>
export function createIterator(collection: { length: number }): Iterator<any>
export function createIterator(collection: any): void | Iterator<any>
}