BrandTurner / bluefeather

A collection of Promise utilities.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bluefeather

Travis build status Coveralls NPM version Canonical Code Style

A collection of Promise utilities.

Utility functions

delay

type DelayType = (ms: number) => Promise<void>;

/**
 * Creates a promise that is scheduled to resolve after a set delay.
 */
const delay: DelayType;

mapSeries

type CallbackType = (currentValue: any, index: any, values: Iterable<any>) => any;

type MapSeriesType = (values: Array<any>, mapper: CallbackType) => Promise<Array<any>>;

/**
 * Creates a promise that is scheduled to resolve after a set delay.
 */
const mapSeries: MapSeriesType;

promisify

/**
 * @property multipleArguments Makes the resulting promise fulfill with an array of the callback's success value(s).
 */
type PromisifyOptionsType = {|
  multipleArguments?: boolean
|};

type PromisifyType = (nodeFunction: Function, options?: PromisifyOptionsType) => Function;

/**
 * Creates a function that when executed returns a promise whose fait depends
 * on the callback provided as the last parameter to the wrapped function.
 */
const promisify: PromisifyType;

About

A collection of Promise utilities.

License:Other


Languages

Language:JavaScript 100.0%