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

promiser.js

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

promiser.js - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

2

package.json
{
"name": "promiser.js",
"version": "1.0.1",
"version": "1.0.2",
"description": "Creates a native ES6 Promise from a function which takes a node style Error-First callback.",

@@ -5,0 +5,0 @@ "main": "promiser.js",

@@ -7,7 +7,7 @@ const createPromise = (fttc, context) => {

return new Promise((resolve, reject) => {
fttc.apply(context, args.concat((err, res) => {
fttc.apply(context, args.concat((err, ...res) => {
if (err) {
reject(err);
} else {
resolve(res);
resolve(...res);
}

@@ -14,0 +14,0 @@ }));

# promiser.js
Create native ES6 promises from functions which take node-style callbacks.
## How to use
## How to use

@@ -12,3 +12,3 @@ ### require the library:

const fs = require('fs');
createPromise(fs.readFile)('test.js', 'utf8').

@@ -40,3 +40,3 @@ then(() => console.log('SUCCESSFUL SUCCESS (function)')).

}
Instantiate the class, then create a promise from the method `a` by passing it to promiser,

@@ -50,7 +50,7 @@ just don't forget to pass the context aswell!

catch(console.error);
const testClassFailure = new TestClass('FAILED FAILURE (method)', 'SUCCESSFUL FAILURE (method)', false);
createPromise(testClassFailure.a, testClassFailure)().
then(console.log).
catch(console.error);
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