Comparing version 0.4.6 to 0.4.7
{ | ||
"name": "p-promise", | ||
"main": "p.js", | ||
"version": "0.4.6", | ||
"version": "0.4.7", | ||
"homepage": "https://github.com/rkatic/p", | ||
@@ -6,0 +6,0 @@ "authors": [ |
18
p.js
@@ -411,3 +411,3 @@ /*! | ||
if ( typeof then === "function" ) { | ||
TryResolver( resolverFor(p), then, x ); | ||
TryResolver( resolverFor(p, false), then, x ); | ||
@@ -517,7 +517,7 @@ } else { | ||
function dualResolverFor( promise, nodelike ) { | ||
function resolverFor( promise, nodelike ) { | ||
var done = false; | ||
var trace = P.longStackSupport ? getTrace() : null; | ||
return function( error, y ) { | ||
function resolve( error, y ) { | ||
if ( !done ) { | ||
@@ -546,9 +546,5 @@ done = true; | ||
} | ||
}; | ||
} | ||
} | ||
function resolverFor( promise ) { | ||
var resolve = dualResolverFor( promise, false ); | ||
return { | ||
return nodelike ? resolve : { | ||
promise: promise, | ||
@@ -568,3 +564,3 @@ | ||
function defer() { | ||
return resolverFor( new Promise() ); | ||
return resolverFor( new Promise(), false ); | ||
} | ||
@@ -835,3 +831,3 @@ | ||
var args = new Array( i + 1 ); | ||
args[i] = dualResolverFor( promise, true ); | ||
args[i] = resolverFor( promise, true ); | ||
while ( i-- ) { | ||
@@ -838,0 +834,0 @@ args[i] = arguments[i]; |
@@ -1,1 +0,1 @@ | ||
(function(n){if(typeof module!=="undefined"&&module&&module.exports){module.exports=n()}else if(typeof define==="function"&&define.amd){define(n)}else{P=n()}})(function(){"use strict";var n=i,e=a(),t,r=null;function i(n){if(!n.stack){try{throw n}catch(e){}}return n}if((new Error).stack){n=function(n){return n}}function o(){var e=n(new Error).stack;if(!e){return null}var t=[f(e,1)];if(r){t=t.concat(r);if(t.length===128){t.pop()}}return t}function u(n){var e=/at .+ \((.+):(\d+):(?:\d+)\)$/.exec(n)||/at ([^ ]+):(\d+):(?:\d+)$/.exec(n)||/@(.+):(\d+):(?:\d+)$/.exec(n);return e?{fileName:e[1],lineNumber:Number(e[2])}:null}function a(){var e=n(new Error).stack;if(!e){return 0}var r=e.split("\n");var i=r[0].indexOf("@")>0?r[1]:r[2];var o=u(i);if(!o){return 0}t=o.fileName;return o.lineNumber}function f(n,e){var t=n.split("\n");var r=[];for(var i=e|0,o=t.length;i<o;++i){var u=t[i];if(u&&!l(u)&&!c(u)){r.push(u)}}return r.join("\n")}function l(n){return n.indexOf("(module.js:")!==-1||n.indexOf("(node.js:")!==-1}function c(n){var r=u(n);return!!r&&r.fileName===t&&r.lineNumber>=e&&r.lineNumber<=_e}var s="\nFrom previous event:\n";function v(e){if(e instanceof Error){var t=e.stack;if(!t){t=n(e).stack}else if(~t.indexOf(s)){return}if(t){e.stack=[f(t,0)].concat(r||[]).join(s)}}}var p=N(typeof process)&&process!=null&&{}.toString.call(process)==="[object process]",d=typeof setImmediate==="function",h=N(typeof MutationObserver)&&MutationObserver||N(typeof WebKitMutationObserver)&&WebKitMutationObserver,_=new E,m=_,y=false,w=0,b=p?M:h?$(A):K(A),g=[],x=K(O),k,T,j=N.call,S=N.apply;m.next=_;function E(){this.a=null;this.b=null;this.next=null}function N(n){return n==="object"||n==="function"}function O(){if(g.length){throw g.shift()}}function A(){while(_!==m){var n=_=_.next;if(w>=1024){m.next=m.next.next}else{++w}var e=n.a;var t=n.b;n.a=null;n.b=null;te(e,t)}y=false;r=null}function I(n,e){var t=m.next;if(t===_){m.next=t=new E;t.next=_}else{--w}m=t;t.a=n;t.b=e;if(!y){y=true;b()}}function M(){var n=process.domain;if(n){if(!T)T=(1,require)("domain");T.active=process.domain=null}if(y&&d){setImmediate(A)}else{process.nextTick(A)}if(n){T.active=process.domain=n}}function $(n){var e=1;var t=document.createTextNode("");var r=new h(n);r.observe(t,{characterData:true});return function(){e=-e;t.data=e}}function K(n){return function(){var e=setTimeout(r,0);var t=setInterval(r,50);function r(){clearTimeout(e);clearInterval(t);n()}}}if(p){k=function(n){r=null;b();throw n}}else{k=function(n){g.push(n);x()}}var W=0;var q=1;var D=2;var F=0;var P=-1;var Y=-2;var z=G(void 0);function B(n){if(G.onerror){(1,G.onerror)(n)}else{throw n}}function C(n){if(n._state===D){if(n._domain){n._domain.enter()}k(n._value)}}function G(n){return n instanceof fe?n:Q(new fe,n)}G.longStackSupport=false;function H(n,e){if(n._state){return}n._state=q;n._value=e;Z(n)}function J(n,e){if(n._state){return}if(r){v(e)}n._state=D;n._value=e;if(p){n._domain=process.domain}Z(n)}function L(n,e){if(e._state){return}e._state=n._state;e._value=n._value;e._domain=n._domain;Z(e)}function Q(n,e){if(n._state){return n}if(e instanceof fe){R(n,e)}else{var t=typeof e;if(t==="object"&&e!==null||t==="function"){U(n,e)}else{H(n,e)}}return n}function R(n,e){if(e===n){J(n,new TypeError("You can't resolve a promise with itself"))}else if(e._state){L(e,n)}else{ee(e,P,n)}}function U(n,e){var t=V(n,e);if(typeof t==="function"){X(oe(n),t,e)}else{H(n,e)}}function V(n,e){try{return e.then}catch(t){J(n,t);return null}}function X(n,e,t){try{j.call(e,t,n.resolve,n.reject)}catch(r){n.reject(r)}}function Z(n){if(n._pending){ne(n,n._op,n._pending);n._pending=null}}function ne(n,e,t){if(e>=0){t(n,e)}else if(e===P){I(n,t)}else{for(var r=0,i=t.length;r<i;r+=2){ne(n,t[r],t[r+1])}}}function ee(n,e,t){if(n._state){ne(n,e,t)}else if(!n._pending){n._pending=t;n._op=e}else if(n._op===Y){n._pending.push(e,t)}else{n._pending=[n._op,n._pending,e,t];n._op=Y}}function te(n,e){var t=n._domain||e._domain;r=e._trace;var i=n._state===q?e._cb:e._eb;e._cb=null;e._eb=null;e._domain=null;e._trace=null;if(i===null){L(n,e)}else if(t){if(!t._disposed){t.enter();re(e,i,n._value);t.exit()}}else{re(e,i,n._value)}}function re(n,e,t){var r;try{r=e(t)}catch(i){J(n,i);return}Q(n,r)}function ie(n,e){var t=false;var i=G.longStackSupport?o():null;return function(o,u){if(!t){t=true;if(i){if(r){i=null}else{r=i}}if(o){J(n,e?o:u)}else{Q(n,u)}if(i){r=null}}}}function oe(n){var e=ie(n,false);return{promise:n,resolve:function(n){e(false,n)},reject:function(n){e(true,n)}}}G.defer=ue;function ue(){return oe(new fe)}G.reject=ae;function ae(n){var e=new fe;J(e,n);return e}function fe(){this._state=0;this._value=void 0;this._domain=null;this._cb=null;this._eb=null;this._op=0;this._pending=null;this._trace=null}fe.prototype._clone=function(){var n=new fe;R(n,this);return n};fe.prototype.then=function(n,e){var t=new fe;t._cb=typeof n==="function"?n:null;t._eb=typeof e==="function"?e:null;if(G.longStackSupport){t._trace=o()}if(p){t._domain=process.domain}if(this._state){I(this,t)}else{ee(this,P,t)}return t};fe.prototype.done=function(n,e){var t=this;if(n||e){t=t.then(n,e)}t=t.then(null,B);ee(t,F,C)};fe.prototype.fail=function(n){return this.then(null,n)};fe.prototype.fin=function(n){var e=this;var t=e.then(r,r);function r(){return G(n()).then(function(){L(e,t)})}return t};fe.prototype.spread=function(n,e){return this.then(ve).then(function(e){return S.call(n,void 0,e)},e)};fe.prototype.timeout=function(n,e){var t=this._clone();if(this._state===W){var i=G.longStackSupport?o():null;var u=setTimeout(function(){r=i;J(t,new Error(e||"Timed out after "+n+" ms"));r=null},n);ee(this,F,function(){clearTimeout(u)})}return t};fe.prototype.delay=function(n){var e=new fe;ee(this,F,function(t){if(t._state===q){setTimeout(function(){L(t,e)},n)}else{z.then(function(){L(t,e)})}});return e};fe.prototype.all=function(){return this.then(ve)};fe.prototype.allSettled=function(){return this.then(ce)};fe.prototype.inspect=function(){switch(this._state){case W:return{state:"pending"};case q:return{state:"fulfilled",value:this._value};case D:return{state:"rejected",reason:this._value};default:throw new TypeError("invalid state")}};fe.prototype.nodeify=function(n){if(n){this.done(function(e){n(null,e)},n);return void 0}else{return this}};G.allSettled=le;function le(n){var e=ce(n);return e._state?e:e._clone()}function ce(n){var e=new fe;var t=n.length;if(typeof t!=="number"){J(e,new TypeError("input not array-like"));return e}var r=new Array(t);var i=t;function o(n,t){r[t]=n.inspect();if(--i===0){H(e,r)}}for(var u=0;u<t;++u){ee(G(n[u]),u,o)}if(i===0){H(e,r)}return e}G.all=se;function se(n){var e=ve(n);return e._state?e:e._clone()}function ve(n){var e=new fe;var t=n.length;if(typeof t!=="number"){J(e,new TypeError("input not array-like"));return e}var r=new Array(t);var i=t;function o(n,t){if(r!==null){if(n._state===D){r=null;L(n,e)}else{r[t]=n._value;if(--i===0){H(e,r)}}}}for(var u=0;u<t;++u){ee(G(n[u]),u,o)}if(i===0){H(e,r)}return e}G.spread=pe;function pe(n,e,t){return ve(n).then(function(n){return S.call(e,void 0,n)},t)}G.promised=de;function de(n){function e(e){return j.apply(n,e)}return function(){var n=arguments.length;var t=new Array(n+1);t[0]=this;for(var r=0;r<n;++r){t[r+1]=arguments[r]}return ve(t).then(e)}}G.denodeify=he;function he(n){return function(){var e=new fe;var t=arguments.length;var r=new Array(t+1);r[t]=ie(e,true);while(t--){r[t]=arguments[t]}S.call(n,this,r);return e}}G.onerror=null;G.nextTick=function me(n){var e=z.then(function(){n.call()});ee(e,F,C)};var _e=a();return G}); | ||
(function(n){if(typeof module!=="undefined"&&module&&module.exports){module.exports=n()}else if(typeof define==="function"&&define.amd){define(n)}else{P=n()}})(function(){"use strict";var n=i,e=a(),t,r=null;function i(n){if(!n.stack){try{throw n}catch(e){}}return n}if((new Error).stack){n=function(n){return n}}function o(){var e=n(new Error).stack;if(!e){return null}var t=[f(e,1)];if(r){t=t.concat(r);if(t.length===128){t.pop()}}return t}function u(n){var e=/at .+ \((.+):(\d+):(?:\d+)\)$/.exec(n)||/at ([^ ]+):(\d+):(?:\d+)$/.exec(n)||/@(.+):(\d+):(?:\d+)$/.exec(n);return e?{fileName:e[1],lineNumber:Number(e[2])}:null}function a(){var e=n(new Error).stack;if(!e){return 0}var r=e.split("\n");var i=r[0].indexOf("@")>0?r[1]:r[2];var o=u(i);if(!o){return 0}t=o.fileName;return o.lineNumber}function f(n,e){var t=n.split("\n");var r=[];for(var i=e|0,o=t.length;i<o;++i){var u=t[i];if(u&&!l(u)&&!c(u)){r.push(u)}}return r.join("\n")}function l(n){return n.indexOf("(module.js:")!==-1||n.indexOf("(node.js:")!==-1}function c(n){var r=u(n);return!!r&&r.fileName===t&&r.lineNumber>=e&&r.lineNumber<=he}var s="\nFrom previous event:\n";function v(e){if(e instanceof Error){var t=e.stack;if(!t){t=n(e).stack}else if(~t.indexOf(s)){return}if(t){e.stack=[f(t,0)].concat(r||[]).join(s)}}}var p=N(typeof process)&&process!=null&&{}.toString.call(process)==="[object process]",d=typeof setImmediate==="function",h=N(typeof MutationObserver)&&MutationObserver||N(typeof WebKitMutationObserver)&&WebKitMutationObserver,_=new E,m=_,y=false,w=0,b=p?M:h?$(A):K(A),g=[],x=K(O),k,T,j=N.call,S=N.apply;m.next=_;function E(){this.a=null;this.b=null;this.next=null}function N(n){return n==="object"||n==="function"}function O(){if(g.length){throw g.shift()}}function A(){while(_!==m){var n=_=_.next;if(w>=1024){m.next=m.next.next}else{++w}var e=n.a;var t=n.b;n.a=null;n.b=null;te(e,t)}y=false;r=null}function I(n,e){var t=m.next;if(t===_){m.next=t=new E;t.next=_}else{--w}m=t;t.a=n;t.b=e;if(!y){y=true;b()}}function M(){var n=process.domain;if(n){if(!T)T=(1,require)("domain");T.active=process.domain=null}if(y&&d){setImmediate(A)}else{process.nextTick(A)}if(n){T.active=process.domain=n}}function $(n){var e=1;var t=document.createTextNode("");var r=new h(n);r.observe(t,{characterData:true});return function(){e=-e;t.data=e}}function K(n){return function(){var e=setTimeout(r,0);var t=setInterval(r,50);function r(){clearTimeout(e);clearInterval(t);n()}}}if(p){k=function(n){r=null;b();throw n}}else{k=function(n){g.push(n);x()}}var W=0;var q=1;var D=2;var F=0;var P=-1;var Y=-2;var z=G(void 0);function B(n){if(G.onerror){(1,G.onerror)(n)}else{throw n}}function C(n){if(n._state===D){if(n._domain){n._domain.enter()}k(n._value)}}function G(n){return n instanceof ae?n:Q(new ae,n)}G.longStackSupport=false;function H(n,e){if(n._state){return}n._state=q;n._value=e;Z(n)}function J(n,e){if(n._state){return}if(r){v(e)}n._state=D;n._value=e;if(p){n._domain=process.domain}Z(n)}function L(n,e){if(e._state){return}e._state=n._state;e._value=n._value;e._domain=n._domain;Z(e)}function Q(n,e){if(n._state){return n}if(e instanceof ae){R(n,e)}else{var t=typeof e;if(t==="object"&&e!==null||t==="function"){U(n,e)}else{H(n,e)}}return n}function R(n,e){if(e===n){J(n,new TypeError("You can't resolve a promise with itself"))}else if(e._state){L(e,n)}else{ee(e,P,n)}}function U(n,e){var t=V(n,e);if(typeof t==="function"){X(ie(n,false),t,e)}else{H(n,e)}}function V(n,e){try{return e.then}catch(t){J(n,t);return null}}function X(n,e,t){try{j.call(e,t,n.resolve,n.reject)}catch(r){n.reject(r)}}function Z(n){if(n._pending){ne(n,n._op,n._pending);n._pending=null}}function ne(n,e,t){if(e>=0){t(n,e)}else if(e===P){I(n,t)}else{for(var r=0,i=t.length;r<i;r+=2){ne(n,t[r],t[r+1])}}}function ee(n,e,t){if(n._state){ne(n,e,t)}else if(!n._pending){n._pending=t;n._op=e}else if(n._op===Y){n._pending.push(e,t)}else{n._pending=[n._op,n._pending,e,t];n._op=Y}}function te(n,e){var t=n._domain||e._domain;r=e._trace;var i=n._state===q?e._cb:e._eb;e._cb=null;e._eb=null;e._domain=null;e._trace=null;if(i===null){L(n,e)}else if(t){if(!t._disposed){t.enter();re(e,i,n._value);t.exit()}}else{re(e,i,n._value)}}function re(n,e,t){var r;try{r=e(t)}catch(i){J(n,i);return}Q(n,r)}function ie(n,e){var t=false;var i=G.longStackSupport?o():null;function u(o,u){if(!t){t=true;if(i){if(r){i=null}else{r=i}}if(o){J(n,e?o:u)}else{Q(n,u)}if(i){r=null}}}return e?u:{promise:n,resolve:function(n){u(false,n)},reject:function(n){u(true,n)}}}G.defer=oe;function oe(){return ie(new ae,false)}G.reject=ue;function ue(n){var e=new ae;J(e,n);return e}function ae(){this._state=0;this._value=void 0;this._domain=null;this._cb=null;this._eb=null;this._op=0;this._pending=null;this._trace=null}ae.prototype._clone=function(){var n=new ae;R(n,this);return n};ae.prototype.then=function(n,e){var t=new ae;t._cb=typeof n==="function"?n:null;t._eb=typeof e==="function"?e:null;if(G.longStackSupport){t._trace=o()}if(p){t._domain=process.domain}if(this._state){I(this,t)}else{ee(this,P,t)}return t};ae.prototype.done=function(n,e){var t=this;if(n||e){t=t.then(n,e)}t=t.then(null,B);ee(t,F,C)};ae.prototype.fail=function(n){return this.then(null,n)};ae.prototype.fin=function(n){var e=this;var t=e.then(r,r);function r(){return G(n()).then(function(){L(e,t)})}return t};ae.prototype.spread=function(n,e){return this.then(se).then(function(e){return S.call(n,void 0,e)},e)};ae.prototype.timeout=function(n,e){var t=this._clone();if(this._state===W){var i=G.longStackSupport?o():null;var u=setTimeout(function(){r=i;J(t,new Error(e||"Timed out after "+n+" ms"));r=null},n);ee(this,F,function(){clearTimeout(u)})}return t};ae.prototype.delay=function(n){var e=new ae;ee(this,F,function(t){if(t._state===q){setTimeout(function(){L(t,e)},n)}else{z.then(function(){L(t,e)})}});return e};ae.prototype.all=function(){return this.then(se)};ae.prototype.allSettled=function(){return this.then(le)};ae.prototype.inspect=function(){switch(this._state){case W:return{state:"pending"};case q:return{state:"fulfilled",value:this._value};case D:return{state:"rejected",reason:this._value};default:throw new TypeError("invalid state")}};ae.prototype.nodeify=function(n){if(n){this.done(function(e){n(null,e)},n);return void 0}else{return this}};G.allSettled=fe;function fe(n){var e=le(n);return e._state?e:e._clone()}function le(n){var e=new ae;var t=n.length;if(typeof t!=="number"){J(e,new TypeError("input not array-like"));return e}var r=new Array(t);var i=t;function o(n,t){r[t]=n.inspect();if(--i===0){H(e,r)}}for(var u=0;u<t;++u){ee(G(n[u]),u,o)}if(i===0){H(e,r)}return e}G.all=ce;function ce(n){var e=se(n);return e._state?e:e._clone()}function se(n){var e=new ae;var t=n.length;if(typeof t!=="number"){J(e,new TypeError("input not array-like"));return e}var r=new Array(t);var i=t;function o(n,t){if(r!==null){if(n._state===D){r=null;L(n,e)}else{r[t]=n._value;if(--i===0){H(e,r)}}}}for(var u=0;u<t;++u){ee(G(n[u]),u,o)}if(i===0){H(e,r)}return e}G.spread=ve;function ve(n,e,t){return se(n).then(function(n){return S.call(e,void 0,n)},t)}G.promised=pe;function pe(n){function e(e){return j.apply(n,e)}return function(){var n=arguments.length;var t=new Array(n+1);t[0]=this;for(var r=0;r<n;++r){t[r+1]=arguments[r]}return se(t).then(e)}}G.denodeify=de;function de(n){return function(){var e=new ae;var t=arguments.length;var r=new Array(t+1);r[t]=ie(e,true);while(t--){r[t]=arguments[t]}S.call(n,this,r);return e}}G.onerror=null;G.nextTick=function _e(n){var e=z.then(function(){n.call()});ee(e,F,C)};var he=a();return G}); |
{ | ||
"name": "p-promise", | ||
"version": "0.4.6", | ||
"version": "0.4.7", | ||
"description": "A simple Promises/A+ library.", | ||
@@ -5,0 +5,0 @@ "author": "Robert Katić <robert.katic@gmail.com> (https://github.com/rkatic)", |
@@ -1,2 +0,2 @@ | ||
--- AUTO GENERATED CONTENT --- (2014/7/4 14:39:17) | ||
--- AUTO GENERATED CONTENT --- (2014/7/10 12:28:32) | ||
withStackThrowing : not optimized : 0 | ||
@@ -34,3 +34,2 @@ getTrace : not optimized : 0 | ||
HandleCallback : not optimized : 0 | ||
dualResolverFor : optimized : 1 | ||
resolverFor : optimized : 1 | ||
@@ -37,0 +36,0 @@ defer : optimized : 1 |
@@ -411,3 +411,3 @@ /*! | ||
if ( typeof then === "function" ) { | ||
TryResolver( resolverFor(p), then, x ); | ||
TryResolver( resolverFor(p, false), then, x ); | ||
@@ -517,7 +517,7 @@ } else { | ||
TRACE_FUNCTIONS.fn = dualResolverFor; function dualResolverFor( promise, nodelike ) { | ||
TRACE_FUNCTIONS.fn = resolverFor; function resolverFor( promise, nodelike ) { | ||
var done = false; | ||
var trace = P.longStackSupport ? getTrace() : null; | ||
return function( error, y ) { | ||
TRACE_FUNCTIONS.fn = resolve; function resolve( error, y ) { | ||
if ( !done ) { | ||
@@ -546,9 +546,5 @@ done = true; | ||
} | ||
}; | ||
} | ||
} | ||
TRACE_FUNCTIONS.fn = resolverFor; function resolverFor( promise ) { | ||
var resolve = dualResolverFor( promise, false ); | ||
return { | ||
return nodelike ? resolve : { | ||
promise: promise, | ||
@@ -568,3 +564,3 @@ | ||
TRACE_FUNCTIONS.fn = defer; function defer() { | ||
return resolverFor( new Promise() ); | ||
return resolverFor( new Promise(), false ); | ||
} | ||
@@ -835,3 +831,3 @@ | ||
var args = new Array( i + 1 ); | ||
args[i] = dualResolverFor( promise, true ); | ||
args[i] = resolverFor( promise, true ); | ||
while ( i-- ) { | ||
@@ -838,0 +834,0 @@ args[i] = arguments[i]; |
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
2189064
3177