New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

resolve-when

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

resolve-when

Returns a promise that resolves once condition is met

  • 1.0.7
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
45
increased by9.76%
Maintainers
1
Weekly downloads
 
Created
Source

resolve-when

Build Status Known Vulnerabilities CodeFactor Codacy Badge Maintainability Test Coverage Greenkeeper badge FOSSA Status

Returns a promise that resolves once condition is met

Installation

NPM

resolve-when is published at npmjs.com, and can be installed using npm or yarn.

$ npm install resolve-when  # npm
$ yarn add resolve-when     # yarn
import resolveWhen from 'resolve-when';       // ES6+
const resolveWhen = require('resolve-when');  // ES5

Usage

resolveWhen is a function with the following signature:

resolveWhen(condition, options)
  • condition Function - a function that will be evaluated to determine when resolveWhen should resolve. It is not passed any parameters. Defaults to a function that always resolves to true
  • options Object
    • max Integer - Maximum number of times that condition should be ran. If max is undefined, 0, a negative number, or Infinity, it will iterate forever. Defaults to undefined
    • interval Integer - Number of milliseconds to wait before running condition again. Defaults to 50

Defaults properties

resolveWhen.defaults is a read-only property containing the default options object used.

Return Values

If condition returns true, resolveWhen will resolve without any value.

If the maximum number of iterations has been reached and condition has not returned true, resolveWhen will reject with Error(`Maximum iterations (${max}) exceeded`), where max is the same as options.max

Contributing

$ git clone git@github.com:d4nyll/resolve-when.git
$ yarn
$ yarn run test

Tests

Tests are written in Mocha with the assert module. We are also using lolex as a fake timer to ensure our unit tests run as quick as possible.

Code Quality

We have used husky to help you ensure:

  • Your code is linted
  • All tests pass
  • Coverage is at 100%

Any PRs which does not pass the linter, tests or coverage tools will be rejected.

License

FOSSA Status

Keywords

FAQs

Package last updated on 19 Sep 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