/**
 * 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.
 *
 * @flow
 */

// Note: Flow already has built-in definitions for
// Iterable<TValue> and Iterator<TValue> so they are not defined here.

declare export var $$iterator: $SymbolIterator | string

declare export function isIterable(obj: any): boolean

declare export function isArrayLike(obj: any): boolean

declare export function isCollection(obj: any): boolean

declare export function getIterator<TValue>(iterable: Iterable<TValue>): Iterator<TValue>
declare export function getIterator(iterable: any): void | Iterator<mixed>

declare export function getIteratorMethod<TValue>(iterable: Iterable<TValue>): () => Iterator<TValue>
declare export function getIteratorMethod(iterable: any): void | () => Iterator<mixed>

declare export function forEach<TValue, TCollection: Iterable<TValue>>(collection: TCollection, callbackFn: (value: TValue, index: number, collection: TCollection) => any, thisArg?: any): void
declare export function forEach<TCollection: { length: number }>(collection: TCollection, callbackFn: (value: mixed, index: number, collection: TCollection) => any, thisArg?: any): void

declare export function createIterator<TValue>(collection: Iterable<TValue>): Iterator<TValue>
declare export function createIterator(collection: { length: number }): Iterator<mixed>
declare export function createIterator(collection: any): void | Iterator<mixed>
