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

when

Package Overview
Dependencies
Maintainers
1
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

when - npm Package Compare versions

Comparing version 3.7.3 to 3.7.4

36

keys.js

@@ -19,3 +19,4 @@ /** @license MIT License (c) copyright 2011-2013 original author or authors */

all: when.lift(all),
map: map
map: map,
settle: settle
};

@@ -80,3 +81,36 @@

/**
* Resolve all key-value pairs in the supplied object and return a promise
* that will always fulfill with the outcome states of all input promises.
* @param {object} object whose key-value pairs will be settled
* @returns {Promise} promise for an object with the mapped and fully
* settled key-value pairs
*/
function settle(object) {
var keys = Object.keys(object);
var results = {};
if(keys.length === 0) {
return toPromise(results);
}
var p = Promise._defer();
var resolver = Promise._handler(p);
var promises = keys.map(function(k) { return object[k]; });
when.settle(promises).then(function(states) {
populateResults(keys, states, results, resolver);
});
return p;
}
function populateResults(keys, states, results, resolver) {
for(var i=0; i<keys.length; i++) {
results[keys[i]] = states[i];
}
resolver.resolve(results);
}
});
})(typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); });

174

package.json
{
"name": "when",
"version": "3.7.3",
"description": "A lightweight Promises/A+ and when() implementation, plus other async goodies.",
"keywords": [
"cujo",
"Promises/A+",
"promises-aplus",
"promise",
"promises",
"deferred",
"deferreds",
"when",
"async",
"asynchronous",
"ender"
],
"homepage": "http://cujojs.com",
"licenses": [
{
"type": "MIT",
"url": "http://www.opensource.org/licenses/mit-license.php"
}
],
"repository": {
"type": "git",
"url": "https://github.com/cujojs/when"
},
"bugs": "https://github.com/cujojs/when/issues",
"maintainers": [
{
"name": "Brian Cavalier",
"web": "http://hovercraftstudios.com"
},
{
"name": "John Hann",
"web": "http://unscriptable.com"
}
],
"contributors": [
{
"name": "Brian Cavalier",
"web": "http://hovercraftstudios.com"
},
{
"name": "John Hann",
"web": "http://unscriptable.com"
},
{
"name": "Scott Andrews"
}
],
"devDependencies": {
"promises-aplus-tests": "~2",
"benchmark": "~1",
"microtime": "~0",
"browserify": "~2",
"buster": "~0.7",
"jshint": "~2",
"rest": "1.1.x",
"optimist": "~0.6",
"sauce-connect-launcher": "~0.4",
"wd": "~0.2",
"json5": "~0.2",
"poly": "git://github.com/cujojs/poly#0.6.0"
},
"main": "when",
"ender": { "files": ["*.js", "lib/*.js", "node/*.js", "unfold/*.js", "monitor/*.js"] },
"browser": {
"vertx": false
},
"directories": {
"test": "test"
},
"scripts": {
"test": "jshint . && buster-test -e node && promises-aplus-tests test/promises-aplus-adapter.js",
"build-browser-test": "browserify ./node_modules/poly/es5.js -o test/browser/es5.js && browserify ./test/*-test.js ./test/**/*-test.js -o test/browser/tests.js -x buster ",
"browser-test": "npm run build-browser-test && buster-static -e browser -p 8080",
"ci": "npm test && node test/sauce.js",
"tunnel": "node test/sauce.js -m",
"start": "buster-static -e browser",
"benchmark": "node benchmark/promise && node benchmark/map",
"browserify-es6": "browserify -s Promise es6-shim/Promise.browserify-es6.js --no-detect-globals -o es6-shim/Promise.js",
"browserify": "browserify -s when build/when.browserify.js --no-detect-globals -o build/when.js",
"browserify-debug": "browserify -s when build/when.browserify-debug.js --no-detect-globals -o build/when.js"
}
"name": "when",
"version": "3.7.4",
"description": "A lightweight Promises/A+ and when() implementation, plus other async goodies.",
"keywords": [
"cujo",
"Promises/A+",
"promises-aplus",
"promise",
"promises",
"deferred",
"deferreds",
"when",
"async",
"asynchronous",
"ender"
],
"homepage": "http://cujojs.com",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/cujojs/when"
},
"bugs": "https://github.com/cujojs/when/issues",
"maintainers": [
{
"name": "Brian Cavalier",
"web": "http://hovercraftstudios.com"
},
{
"name": "John Hann",
"web": "http://unscriptable.com"
}
],
"contributors": [
{
"name": "Brian Cavalier",
"web": "http://hovercraftstudios.com"
},
{
"name": "John Hann",
"web": "http://unscriptable.com"
},
{
"name": "Scott Andrews"
}
],
"devDependencies": {
"promises-aplus-tests": "~2",
"benchmark": "~1",
"microtime": "~0",
"browserify": "~2",
"buster": "~0.7",
"jshint": "~2",
"rest": "1.1.x",
"optimist": "~0.6",
"poly": "^0.6.1",
"sauce-connect-launcher": "~0.4",
"wd": "~0.2",
"json5": "~0.2"
},
"main": "when",
"ender": {
"files": [
"*.js",
"lib/*.js",
"node/*.js",
"unfold/*.js",
"monitor/*.js",
"lib/decorators/*.js"
]
},
"browser": {
"vertx": false
},
"directories": {
"test": "test"
},
"scripts": {
"test": "jshint . && buster-test -e node && promises-aplus-tests test/promises-aplus-adapter.js",
"build-browser-test": "browserify ./node_modules/poly/es5.js -o test/browser/es5.js && browserify ./test/*-test.js ./test/**/*-test.js -o test/browser/tests.js -x buster ",
"browser-test": "npm run build-browser-test && buster-static -e browser -p 8080",
"ci": "npm test && node test/sauce.js",
"tunnel": "node test/sauce.js -m",
"start": "buster-static -e browser",
"benchmark": "node benchmark/promise && node benchmark/map",
"browserify-es6": "browserify -s Promise es6-shim/Promise.browserify-es6.js --no-detect-globals -o es6-shim/Promise.js",
"browserify": "browserify -s when build/when.browserify.js --no-detect-globals -o build/when.js",
"browserify-debug": "browserify -s when build/when.browserify-debug.js --no-detect-globals -o build/when.js"
}
}
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