Comparing version 3.6.1 to 3.6.2
@@ -427,6 +427,6 @@ !function(e){"object"==typeof exports?module.exports=e():"function"==typeof define&&define.amd?define(e):"undefined"!=typeof window?window.Promise=e():"undefined"!=typeof global?global.Promise=e():"undefined"!=typeof self&&(self.Promise=e())}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
* @param {function=} onRejected rejection handler | ||
* @deprecated @param {function=} onProgress progress handler | ||
* @param {function=} onProgress @deprecated progress handler | ||
* @return {Promise} new promise | ||
*/ | ||
Promise.prototype.then = function(onFulfilled, onRejected) { | ||
Promise.prototype.then = function(onFulfilled, onRejected, onProgress) { | ||
var parent = this._handler; | ||
@@ -444,4 +444,3 @@ var state = parent.join().state(); | ||
parent.chain(child, parent.receiver, onFulfilled, onRejected, | ||
arguments.length > 2 ? arguments[2] : void 0); | ||
parent.chain(child, parent.receiver, onFulfilled, onRejected, onProgress); | ||
@@ -467,7 +466,10 @@ return p; | ||
Promise.prototype._beget = function() { | ||
var parent = this._handler; | ||
var child = new Pending(parent.receiver, parent.join().context); | ||
return new this.constructor(Handler, child); | ||
return begetFrom(this._handler, this.constructor); | ||
}; | ||
function begetFrom(parent, Promise) { | ||
var child = new Pending(parent.receiver, parent.join().context); | ||
return new Promise(Handler, child); | ||
} | ||
// Array combinators | ||
@@ -474,0 +476,0 @@ |
@@ -13,3 +13,3 @@ /** @license MIT License (c) copyright 2010-2014 original author or authors */ | ||
var applyFold = applier(Promise, dispatch); | ||
var applyFold = applier(Promise); | ||
var toPromise = Promise.resolve; | ||
@@ -20,2 +20,3 @@ var all = Promise.all; | ||
var arr = Array.prototype.reduceRight; | ||
var slice = Array.prototype.slice; | ||
@@ -211,4 +212,5 @@ // Additional array combinators | ||
function filter(promises, predicate) { | ||
return Promise._traverse(predicate, promises).then(function(keep) { | ||
return filterSync(promises, keep); | ||
var a = slice.call(promises); | ||
return Promise._traverse(predicate, a).then(function(keep) { | ||
return filterSync(a, keep); | ||
}); | ||
@@ -230,2 +232,3 @@ } | ||
} | ||
/** | ||
@@ -283,6 +286,2 @@ * Return a promise that will always fulfill with an array containing | ||
} | ||
function dispatch(f, _, args, resolver) { | ||
resolver.resolve(f(args[0], args[1], args[2])); | ||
} | ||
}; | ||
@@ -289,0 +288,0 @@ |
@@ -127,6 +127,6 @@ /** @license MIT License (c) copyright 2010-2014 original author or authors */ | ||
* @param {function=} onRejected rejection handler | ||
* @deprecated @param {function=} onProgress progress handler | ||
* @param {function=} onProgress @deprecated progress handler | ||
* @return {Promise} new promise | ||
*/ | ||
Promise.prototype.then = function(onFulfilled, onRejected) { | ||
Promise.prototype.then = function(onFulfilled, onRejected, onProgress) { | ||
var parent = this._handler; | ||
@@ -144,4 +144,3 @@ var state = parent.join().state(); | ||
parent.chain(child, parent.receiver, onFulfilled, onRejected, | ||
arguments.length > 2 ? arguments[2] : void 0); | ||
parent.chain(child, parent.receiver, onFulfilled, onRejected, onProgress); | ||
@@ -167,7 +166,10 @@ return p; | ||
Promise.prototype._beget = function() { | ||
var parent = this._handler; | ||
var child = new Pending(parent.receiver, parent.join().context); | ||
return new this.constructor(Handler, child); | ||
return begetFrom(this._handler, this.constructor); | ||
}; | ||
function begetFrom(parent, Promise) { | ||
var child = new Pending(parent.receiver, parent.join().context); | ||
return new Promise(Handler, child); | ||
} | ||
// Array combinators | ||
@@ -174,0 +176,0 @@ |
{ | ||
"name": "when", | ||
"version": "3.6.1", | ||
"version": "3.6.2", | ||
"description": "A lightweight Promises/A+ and when() implementation, plus other async goodies.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
10
when.js
@@ -8,3 +8,3 @@ /** @license MIT License (c) copyright 2010-2014 original author or authors */ | ||
* @author John Hann | ||
* @version 3.6.1 | ||
* @version 3.6.2 | ||
*/ | ||
@@ -84,11 +84,9 @@ (function(define) { 'use strict'; | ||
*/ | ||
function when(x, onFulfilled, onRejected) { | ||
function when(x, onFulfilled, onRejected, onProgress) { | ||
var p = Promise.resolve(x); | ||
if(arguments.length < 2) { | ||
if (arguments.length < 2) { | ||
return p; | ||
} | ||
return arguments.length > 3 | ||
? p.then(onFulfilled, onRejected, arguments[3]) | ||
: p.then(onFulfilled, onRejected); | ||
return p.then(onFulfilled, onRejected, onProgress); | ||
} | ||
@@ -95,0 +93,0 @@ |
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
146630
4348