Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bluefeather

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bluefeather

A collection of Promise utilities.

  • 2.9.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
13
decreased by-7.14%
Maintainers
1
Weekly downloads
 
Created
Source

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;

map

For the record, this function is just a thin-wrapper around Bluebird#map.

This method is identical to Bluebird#map except that the concurrency setting can be overridden using BLUEFEATHER_MAX_CONCURRENCY environment variable. Controlling max concurrency using environment variables enables debugging of the codebase without refactoring the code.

type MapperType<T, R> = (currentValue: T, index: number, values: $ReadOnlyArray<T>) => R;

type MapConfigurationType = {|
  +concurrency: number
|};

type MapType<T, R> = (values: $ReadOnlyArray<T>, mapper: MapperType<T, R>, configuration?: MapConfigurationType) => Promise<$ReadOnlyArray<R>>;

const map: MapType<*, *>;

mapSeries

type CallbackType<T, R> = (currentValue: T, index: number, values: $ReadOnlyArray<T>) => R;

type MapSeriesType<T, R> = (values: $ReadOnlyArray<T>, mapper: CallbackType<T, R>) => Promise<$ReadOnlyArray<R>>;

/**
 * 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;

suppress

type SuppressType = <T: Promise<*>>(
  ErrorConstructor: Class<Error> | (error: Error) => boolean,
  promise: T
) => T | Promise<void>;

/**
 * Suppresses errors that are instance of ErrorConstructor.
 */
const suppress: SuppressType;

Keywords

FAQs

Package last updated on 23 Oct 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc