Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
promise-factory
Advanced tools
A wrapper for creating promises in JavaScript based on native ES2015 promises.
A wrapper for creating promises in JavaScript based on native ES2015 promises.
npm install promise-factory --save
var pf = require("promise-factory").PromiseFactory;
var fs = require("fs");
pf.createFromNode(fs.readFile.bind(null, "package.json", { "encoding": "utf8" })).then(function(res) {
console.log(res);
});
import {PromiseFactory as pf} from "promise-factory";
pf.create((resolve, reject) => {
resolve("test");
}).then((res) => {
console.log(res);
})
Wraps the Promise.all function.
var pf = require("promise-factory").PromiseFactory;
pf.all([
pf.create(function(resolve, reject) {
resolve("test1");
}),
pf.create(function(resolve, reject) {
resolve("test2");
})
]).then(function(res) {
console.log(res);
});
Wraps the creation of a new promise in a static function.
var pf = require("promise-factory").PromiseFactory;
pf.create(function(resolve, reject) {
resolve("test2");
}).then(function(res) {
console.log(res);
});
Creates a promise from a function that takes a node style callback function as its only argument. Should you want to use a function that takes more arguments, you can bind them before calling this function.
var pf = require("promise-factory").PromiseFactory;
var fs = require("fs");
pf.createFromNode(fs.readFile.bind(null, "package.json", { "encoding": "utf8" })).then(function(res) {
console.log(res);
});
FAQs
A wrapper for creating promises in JavaScript based on native ES2015 promises.
The npm package promise-factory receives a total of 1 weekly downloads. As such, promise-factory popularity was classified as not popular.
We found that promise-factory demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.