All Downloads are FREE. Search and download functionalities are using the official Maven repository.

node_modules.iterall.index.js.flow Maven / Gradle / Ivy

The newest version!
/**
 * 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, Iterator, AsyncIterable, and AsyncIterator so they are not
// defined here.

declare export var $$iterator: '@@iterator'

declare export function isIterable(obj: any): boolean

declare export function isArrayLike(obj: any): boolean

declare export function isCollection(obj: any): boolean

declare export var getIterator:
  & (<+TValue>(iterable: Iterable) => Iterator)
  & ((iterable: mixed) => void | Iterator)

declare export var getIteratorMethod:
  & (<+TValue>(iterable: Iterable) => (() => Iterator))
  & ((iterable: mixed) => (void | (() => Iterator)))

declare export var createIterator:
  & (<+TValue>(collection: Iterable) => Iterator)
  & ((collection: {length: number}) => Iterator)
  & ((collection: mixed) => (void | Iterator))

declare export var forEach:
  & (<+TValue, TCollection: Iterable>(
      collection: TCollection,
      callbackFn: (value: TValue, index: number, collection: TCollection) => any,
      thisArg?: any
    ) => void)
  & ((
      collection: TCollection,
      callbackFn: (value: mixed, index: number, collection: TCollection) => any,
      thisArg?: any
    ) => void)

declare export var $$asyncIterator: '@@asyncIterator'

declare export function isAsyncIterable(obj: any): boolean

declare export var getAsyncIterator:
  & (<+TValue>(asyncIterable: AsyncIterable) => AsyncIterator)
  & ((asyncIterable: mixed) => (void | AsyncIterator))

declare export var getAsyncIteratorMethod:
  & (<+TValue>(asyncIterable: AsyncIterable) => (() => AsyncIterator))
  & ((asyncIterable: mixed) => (void | (() => AsyncIterator)))

declare export var createAsyncIterator:
  & (<+TValue>(
      collection: Iterable | TValue> | AsyncIterable
    ) => AsyncIterator)
  & ((collection: {length: number}) => AsyncIterator)
  & ((collection: mixed) => (void | AsyncIterator))

declare export var forAwaitEach:
  & (<+TValue, TCollection: Iterable | TValue> | AsyncIterable>(
      collection: TCollection,
      callbackFn: (value: TValue, index: number, collection: TCollection) => any,
      thisArg?: any
    ) => Promise)
  & ((
      collection: TCollection,
      callbackFn: (value: mixed, index: number, collection: TCollection) => any,
      thisArg?: any
    ) => Promise)




© 2015 - 2024 Weber Informatics LLC | Privacy Policy