Socket
Socket
Sign inDemoInstall

pinkie-promise

Package Overview
Dependencies
1
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Protect your apps from supply chain attacks

Install

pinkie-promise

ES2015 Promise ponyfill

    2.0.1latest
    GitHub
    npm

Version published
Maintainers
1
Weekly downloads
10,778,670
decreased by-15.69%

Weekly downloads

Package description

What is pinkie-promise?

The pinkie-promise npm package is a lightweight Promise implementation for environments that do not have a native Promise support. It uses the 'pinkie' package as its core to provide a minimal Promise polyfill.

What are pinkie-promise's main functionalities?

Promise creation and usage

This feature allows users to create new promises and handle their resolution or rejection. The code sample demonstrates how to create a new promise and use 'then' and 'catch' methods to handle its outcome.

const pinkiePromise = require('pinkie-promise');

const promise = new pinkiePromise(function(resolve, reject) {
  // Asynchronous operation here
  if (/* operation successful */) {
    resolve('Success!');
  } else {
    reject('Failure!');
  }
});

promise.then(function(value) {
  console.log(value); // 'Success!'
}).catch(function(reason) {
  console.log(reason); // 'Failure!'
});

Chaining promises

This feature demonstrates how promises can be chained to perform a sequence of asynchronous operations where each step waits for the previous one to complete.

const pinkiePromise = require('pinkie-promise');

pinkiePromise.resolve(1)
  .then(function(value) {
    return value + 1;
  })
  .then(function(value) {
    return value + 1;
  })
  .then(function(value) {
    console.log(value); // 3
  });

Other packages similar to pinkie-promise

Readme

Source

pinkie-promise Build Status

ES2015 Promise ponyfill

Module exports global Promise object (if available) or pinkie Promise polyfill.

Install

$ npm install --save pinkie-promise

Usage

var Promise = require('pinkie-promise');

new Promise(function (resolve) { resolve('unicorns'); });
//=> Promise { 'unicorns' }
  • pify - Promisify a callback-style function

License

MIT © Vsevolod Strukchinsky

Keywords

FAQs

Last updated on 10 Apr 2016

Did you know?

Socket installs a GitHub app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the 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