Socket
Socket
Sign inDemoInstall

pinkie

Package Overview
Dependencies
0
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    pinkie

Sweetly small promises/a+ implementation


Version published
Weekly downloads
12M
decreased by-1.21%
Maintainers
1
Install size
9.27 kB
Created
Weekly downloads
 

Readme

Source

pinkie Build Status

Sweetly small ES6 Promise implementation

Install

$ npm install --save pinkie

Usage

var Promise = require('pinkie');

new Promise(function (resolve, reject) {
	got('google.com', function (err, data) {
		if (err) {
			return reject(err);
		}

		resolve(data);
	});
});
//=> Promise

API

new pinkie(executor)

Returns new instance of Promise.

executor

Required
Type: function

Function with two arguments resolve and reject. The first argument fulfills the promise, the second argument rejects it.

pinkie.all(promises)

Returns a promise that resolves when all of the promises in the promises argument have resolved.

pinkie.race(promises)

Returns a promise that resolves or rejects as soon as one of the promises in the promises resolves or rejects, with the value or reason from that promise.

pinkie.reject(reason)

Returns a Promise object that is rejected with the given reason.

pinkie.resolve(value)

Returns a Promise object that is resolved with the given value. If the value is a thenable (i.e. has a then method), the returned promise will "follow" that thenable, adopting its eventual state; otherwise the returned promise will be fulfilled with the value.

License

MIT © Vsevolod Strukchinsky

Keywords

FAQs

Last updated on 10 May 2015

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc