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

resolvable-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

resolvable-promise

Promises with the resolve and reject functions exposed

  • 3.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

resolvable-promise

npm npm type definitions npm modules type npm bundle size

I've found that for the majority of projects I keep needing to rewrite or copy-paste the same small piece of code, a function that creates a promise with the resolve and reject functions exposed. This project is that small snippet of code, created mostly for my own convenience.

Basic Usage

import Resolvable from 'resolvable-promise';

const resolvable = new Resolvable();
resolvable.then(console.log);

console.log('Resolving...');
resolvable.resolve('Resolved!');

Looks like a Promise ✨

Arguments

You can optionally provide Resolvable with an executor callback just like a promise:

const resolvable = new Resolvable((resolve, reject) => {
	// Do something async..
	resolve('Resolved!');
});

It's also possible to provide it with a promise that you might have gotten from somewhere else:

const res = fetch('https://swapi.dev/api/people/');
const resolvable = new Resolvable(res);

Keywords

FAQs

Package last updated on 23 Oct 2022

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