Socket
Book a DemoInstallSign in
Socket

p-deferred

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

p-deferred

Create Deferred Promise

latest
Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

p-deferred

Simple module to create deferred objects:

const defer = require('p-deferred');
const deferred = defer();
deferred.promise.then(
    (value)=>console.log('Resolved: ', value),
    (reason)=>console.error('Rejected: ', reason)
);
if(Math.random() > 0.5) {
    deferred.resolve("This is a success!")
} else {
    deferred.reject("This is a failure!")
}

Keywords

Promise

FAQs

Package last updated on 01 Feb 2017

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