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

faked-promise

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

faked-promise

Create a promise that can be resolved and rejected outside of it

  • 2.2.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
94
Maintainers
1
Weekly downloads
 
Created
Source

faked-promise Build Status npm package coverage thanks

Create a promise that can be resolved and rejected programatically outside of it

It basically extracts the resolve and reject callbacks so you can call them whenever you need. ⚠️ The promise can only be resolved once, it's still a regular Promise after all.

Installation

npm i faked-promise

Usage

faked-promise exports one single function that takes no arguments and returns an array with 3 elements:

  • A real promise
  • Its resolve callback
  • Its reject callback

Meaning you can control exactly when the promise is resolved or rejected:

const fakePromise = require('faked-promise')

const [promise, resolve, reject] = fakePromise()
promise.then(() => {})
resolve('any value')

License

MIT

Keywords

FAQs

Package last updated on 26 Sep 2019

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