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.
all-promises
Advanced tools
This project is try to collect all Promise implementations which follow ECMAScript 6 (which based on Promises/A+ 1.1.1).
The goal of this project is to provide a centric location to ease the comparison and testings of different implementations. Normally you only need one Promise implementation in your application, so you would mostly never use this package in the productions.
npm install all-promises
function getPromiseConstructor(name: string): PromiseConstructor
var Promise = require('all-promises').getPromiseConstructor('q') // q implementation
var p = new Promise(function (resolve) { resolve(1) })
p.then(function (x) { assert(x === 1) })
default: PromiseConstructor
test.js
file:
var Promise = require('all-promises').default // default implementation
You can specify default implementation by passing env variable:
P=rsvp node test
If no env P
is provided, default to V8 native implementation
list: Array<PromiseImplementation>
interface PromiseImplementation {
name: string,
version: string,
aliases: Array<string>,
Promise: PromiseConstructor?,
error: Error?
}
var list = require('all-promises').list
list.forEach(function (impl, index) {
console.log(index + '.',
'package name:', impl.name,
'aliases:', impl.aliases,
'version:', impl.version)
var Promise = impl.Promise // Promise constructor
if (Promise) Promise.resolve(1).then(function (x) { assert(x === 1) })
else console.warn(impl.error)
})
function register(packageName: string, alias?: string|Array<string>, exportPromise?: string|function)
function unregister(name: string): boolean
function has(name: string): boolean
function get(name: string): PromiseImplementation
var promises = require('all-promises')
promises.has('es6-promise-polyfill') // false
promises.register('es6-promise-polyfill')
promises.has('es6-promise-polyfill') // true
var impl = promises.get('es6-promise-polyfill')
assert.deepEqual(impl, {
name: 'es6-promise-polyfill',
aliases: [],
Promise: promises.getPromiseConstructor('es6-promise-polyfill'),
})
promises.unregister('es6-promise-polyfill') // true
promises.has('es6-promise-polyfill') // false
promises.unregister('es6-promise-polyfill') // false
MUST register on npm
MUST support new Promise(function executor(resolve, reject) { ... })
, Promise.resolve()
and Promise.reject()
API
SHOULD pass all Promise/A+ Tests
NOTE: Currently most implementations don't pass ES6 Promise Tests, so it's not on the MUST list up to now.
npm install package-name-of-new-implementation --save
)npm test
, if everything is ok thenbased on es6-promise, so excluded from the registery by default ↩
FAQs
Collect all Promise Implementations
The npm package all-promises receives a total of 10 weekly downloads. As such, all-promises popularity was classified as not popular.
We found that all-promises 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.