promiscuous
Advanced tools
Comparing version 0.6.0 to 0.7.0
@@ -5,6 +5,9 @@ #!/usr/bin/env node | ||
var copyright = fs.readFileSync("promiscuous.js", "utf8").match(/.*\n/)[0]; | ||
var minified = copyright + UglifyJS.minify("promiscuous.js").code; | ||
var browserified = minified.replace("module.exports", "Promise") | ||
.replace("setImmediate", "setTimeout"); | ||
var full = fs.readFileSync("promiscuous.js", "utf8"); | ||
var copyright = full.match(/.*\n/)[0]; | ||
var minified = copyright + UglifyJS.minify(full, { fromString: true }).code; | ||
var browserFull = full.replace("module.exports", "window.Promise") | ||
.replace("setImmediate", "setTimeout"); | ||
var browser = copyright + UglifyJS.minify(browserFull, { fromString: true }).code | ||
.replace("window.Promise", "Promise"); | ||
@@ -16,4 +19,5 @@ var path = "dist/"; | ||
fs.writeFileSync(path + "promiscuous-node.js", minified); | ||
fs.writeFileSync(path + "promiscuous-browser.js", browserified); | ||
fs.writeFileSync(path + "promiscuous-browser.js", browser); | ||
fs.writeFileSync(path + "promiscuous-browser-full.js", browserFull); | ||
fs.writeFileSync(path + "promiscuous-shim.js", | ||
browserified.replace("!", "(typeof Promise)[0]!='u'||")); | ||
browser.replace("!", "(typeof Promise)[0]!='u'||")); |
{ | ||
"name": "promiscuous", | ||
"version": "0.6.0", | ||
"version": "0.7.0", | ||
"description": "A minimal and fast promise implementation", | ||
@@ -5,0 +5,0 @@ "author": "Ruben Verborgh <ruben.verborgh@gmail.com>", |
@@ -69,4 +69,4 @@ /**@license MIT-promiscuous-©Ruben Verborgh*/ | ||
// Create and return the promise (reusing the callback variable) | ||
callback.call(callback = { then: function (resolved, rejected) { return handler(resolved, rejected); }, | ||
catch: function (rejected) { return handler(0, rejected); } }, | ||
callback.call(callback = { then: function (resolved, rejected) { return handler(resolved, rejected); }, | ||
"catch": function (rejected) { return handler(0, rejected); } }, | ||
function (value) { handler(is, 1, value); }, | ||
@@ -128,2 +128,12 @@ function (reason) { handler(is, 0, reason); }); | ||
}; | ||
// Returns a promise that resolves or rejects as soon as one promise in the array does | ||
Promise.race = function (promises) { | ||
return Promise(function (resolve, reject) { | ||
// Register to all promises in the array | ||
promises.map(function (promise) { | ||
ResolvedPromise(promise).then(resolve, reject); | ||
}); | ||
}); | ||
}; | ||
})('f', 'o'); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11669
157