Comparing version 5.0.1 to 5.0.2
@@ -1,2 +0,2 @@ | ||
/*! Promish 08-03-2017 */ | ||
/*! Promish 16-03-2017 */ | ||
!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.Promish=a()}}(function(){var a;return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){"use strict";var d=a("es6-promise").Promise,e=a("./promish-class");b.exports=e(d)},{"./promish-class":2,"es6-promise":3}],2:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function e(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!=typeof b&&"function"!=typeof b?a:b}function f(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function g(a){function b(a){for(;a&&a!==Object;){if(a===Error||a instanceof Error)return!0;a=a.prototype}return!1}var c=function(a){function c(a){if(d(this,c),a instanceof c){var b;return b=a,e(f,b)}if(a instanceof Promise||a.then instanceof Function)var f=e(this,(c.__proto__||Object.getPrototypeOf(c)).call(this,function(b,c){return a.then(b,c)}));else if(a instanceof Error)var f=e(this,(c.__proto__||Object.getPrototypeOf(c)).call(this,function(b,c){return c(a)}));else if(a instanceof Function)var f=e(this,(c.__proto__||Object.getPrototypeOf(c)).call(this,a));else var f=e(this,(c.__proto__||Object.getPrototypeOf(c)).call(this,function(b){return b(a)}));return e(f)}return f(c,a),h(c,[{key:"finally",value:function(a){return this.then(function(b){return c.resolve(a()).then(function(){return b})},function(b){return c.resolve(a()).then(function(){return c.reject(b)})})}},{key:"catch",value:function(){var a=Array.from(arguments),d=a.pop();return this.then(void 0,function(e){if(!a.length)return d(e);for(var f=0;f<a.length;f++){var g=a[f];if(b(g)){if(e instanceof g)return d(e)}else if(g instanceof Function&&g(e))return d(e)}return new c(function(a,b){return b(e)})})}},{key:"delay",value:function(a){return this.then(function(b){return new c(function(c){setTimeout(function(){c(b)},a)})})}},{key:"map",value:function(a){return this.then(function(b){return c.map(b,a)})}},{key:"reduce",value:function(a,b){return this.then(function(d){return c.reduce(d,a,b)})}},{key:"spread",value:function(a){return this.then(function(a){return c.all(a)}).then(function(b){return a.apply(void 0,b)})}}],[{key:"map",value:function(a,b){return c.all(a.map(function(d,e){return c.resolve(d).then(function(c){return b(c,e,a.length)})}))}},{key:"reduce",value:function(a,b,d){var e,f=0;if(void 0!==d)e=c.resolve(d);else{if(!(a.length>1))return c.resolve(a[0]);e=c.resolve(a[f++])}for(;f<a.length;)!function(d){e=e.then(function(e){return c.resolve(a[d]).then(function(a){return b(e,a,d)})})}(f++);return e}},{key:"delay",value:function(a,b){return new c(function(c){setTimeout(function(){c(b)},a)})}},{key:"resolve",value:function(a){return new c(function(b){b(a)})}},{key:"reject",value:function(a){return new c(function(b,c){c(a)})}},{key:"method",value:function(a){return function(){var b=this,d=Array.from(arguments);return new c(function(c){return c(a.apply(b,d))})}}},{key:"apply",value:function(a,b){return b=Array.from(b),new c(function(c,d){b.push(function(){var a=Array.prototype.shift.apply(arguments);a?d(a):c(1===arguments.length?arguments[0]:arguments)}),a.apply(void 0,b)})}},{key:"nfapply",value:function(a,b){return c.apply(a,b)}},{key:"call",value:function(){var a=Array.prototype.shift.apply(arguments);return c.apply(a,arguments)}},{key:"nfcall",value:function(){return c.call.apply(null,arguments)}},{key:"post",value:function(a,b,d){return c.apply(b.bind(a),d)}},{key:"npost",value:function(a,b,d){return c.apply(b.bind(a),d)}},{key:"invoke",value:function(){var a=Array.prototype.shift.apply(arguments),b=Array.prototype.shift.apply(arguments);return c.apply(b.bind(a),arguments)}},{key:"ninvoke",value:function(){return c.invoke(arguments)}},{key:"promisify",value:function(a){return function(){return c.apply(a,arguments)}}},{key:"denodify",value:function(a){return c.promisify(a)}},{key:"nbind",value:function(a,b){return function(){return c.post(b,a,arguments)}}},{key:"bind",value:function(a,b){return function(){return c.post(a,b,arguments)}}},{key:"promisifyAll",value:function(a,b){b=b||{};for(var d=b.inPlace||!1,e=b.suffix||(d?"Async":""),f={},g=a;g&&g!==Object;){for(var h in g)!f[h+e]&&g[h]instanceof Function&&(f[h+e]=c.bind(a,g[h]));g=Object.getPrototypeOf(g)||g.prototype}if(d){for(var i in f)f[i]instanceof Function&&(a[i]=f[i]);f=a}return f}},{key:"all",value:function(a){return new c(Promise.all(a))}},{key:"some",value:function(a,b){return new c(function(c,d){var e=[],f=[];a.forEach(function(g){g.then(function(a){e.push(a),e.length>=b&&c(e)}).catch(function(c){f.push(c),f.length>a.length-b&&d(f)})})})}},{key:"any",value:function(a){return c.some(a,1).then(function(a){return a[0]})}},{key:"defer",value:function(){var a={};return a.promise=new c(function(b,c){a.resolve=b,a.reject=c}),a}},{key:"spread",value:function(a,b){return b.apply(void 0,a)}}]),c}(a);return c}var h=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}();b.exports=g},{}],3:[function(b,c,d){(function(d,e){(function(){"use strict";function f(a){return"function"==typeof a||"object"==typeof a&&null!==a}function g(a){return"function"==typeof a}function h(a){return"object"==typeof a&&null!==a}function i(a){U=a}function j(a){Y=a}function k(){return function(){d.nextTick(p)}}function l(){return function(){T(p)}}function m(){var a=0,b=new _(p),c=document.createTextNode("");return b.observe(c,{characterData:!0}),function(){c.data=a=++a%2}}function n(){var a=new MessageChannel;return a.port1.onmessage=p,function(){a.port2.postMessage(0)}}function o(){return function(){setTimeout(p,1)}}function p(){for(var a=0;a<X;a+=2){var b=ca[a],c=ca[a+1];b(c),ca[a]=void 0,ca[a+1]=void 0}X=0}function q(){try{var a=b,c=a("vertx");return T=c.runOnLoop||c.runOnContext,l()}catch(a){return o()}}function r(){}function s(){return new TypeError("You cannot resolve a promise with itself")}function t(){return new TypeError("A promises callback cannot return that same promise.")}function u(a){try{return a.then}catch(a){return ga.error=a,ga}}function v(a,b,c,d){try{a.call(b,c,d)}catch(a){return a}}function w(a,b,c){Y(function(a){var d=!1,e=v(c,b,function(c){d||(d=!0,b!==c?z(a,c):B(a,c))},function(b){d||(d=!0,C(a,b))},"Settle: "+(a._label||" unknown promise"));!d&&e&&(d=!0,C(a,e))},a)}function x(a,b){b._state===ea?B(a,b._result):b._state===fa?C(a,b._result):D(b,void 0,function(b){z(a,b)},function(b){C(a,b)})}function y(a,b){if(b.constructor===a.constructor)x(a,b);else{var c=u(b);c===ga?C(a,ga.error):void 0===c?B(a,b):g(c)?w(a,b,c):B(a,b)}}function z(a,b){a===b?C(a,s()):f(b)?y(a,b):B(a,b)}function A(a){a._onerror&&a._onerror(a._result),E(a)}function B(a,b){a._state===da&&(a._result=b,a._state=ea,0!==a._subscribers.length&&Y(E,a))}function C(a,b){a._state===da&&(a._state=fa,a._result=b,Y(A,a))}function D(a,b,c,d){var e=a._subscribers,f=e.length;a._onerror=null,e[f]=b,e[f+ea]=c,e[f+fa]=d,0===f&&a._state&&Y(E,a)}function E(a){var b=a._subscribers,c=a._state;if(0!==b.length){for(var d,e,f=a._result,g=0;g<b.length;g+=3)d=b[g],e=b[g+c],d?H(c,d,e,f):e(f);a._subscribers.length=0}}function F(){this.error=null}function G(a,b){try{return a(b)}catch(a){return ha.error=a,ha}}function H(a,b,c,d){var e,f,h,i,j=g(c);if(j){if(e=G(c,d),e===ha?(i=!0,f=e.error,e=null):h=!0,b===e)return void C(b,t())}else e=d,h=!0;b._state!==da||(j&&h?z(b,e):i?C(b,f):a===ea?B(b,e):a===fa&&C(b,e))}function I(a,b){try{b(function(b){z(a,b)},function(b){C(a,b)})}catch(b){C(a,b)}}function J(a,b){var c=this;c._instanceConstructor=a,c.promise=new a(r),c._validateInput(b)?(c._input=b,c.length=b.length,c._remaining=b.length,c._init(),0===c.length?B(c.promise,c._result):(c.length=c.length||0,c._enumerate(),0===c._remaining&&B(c.promise,c._result))):C(c.promise,c._validationError())}function K(a){return new ia(this,a).promise}function L(a){function b(a){z(e,a)}function c(a){C(e,a)}var d=this,e=new d(r);if(!W(a))return C(e,new TypeError("You must pass an array to race.")),e;for(var f=a.length,g=0;e._state===da&&g<f;g++)D(d.resolve(a[g]),void 0,b,c);return e}function M(a){var b=this;if(a&&"object"==typeof a&&a.constructor===b)return a;var c=new b(r);return z(c,a),c}function N(a){var b=this,c=new b(r);return C(c,a),c}function O(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function P(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function Q(a){this._id=na++,this._state=void 0,this._result=void 0,this._subscribers=[],r!==a&&(g(a)||O(),this instanceof Q||P(),I(this,a))}function R(){var a;if("undefined"!=typeof e)a=e;else if("undefined"!=typeof self)a=self;else try{a=Function("return this")()}catch(a){throw new Error("polyfill failed because global object is unavailable in this environment")}var b=a.Promise;b&&"[object Promise]"===Object.prototype.toString.call(b.resolve())&&!b.cast||(a.Promise=oa)}var S;S=Array.isArray?Array.isArray:function(a){return"[object Array]"===Object.prototype.toString.call(a)};var T,U,V,W=S,X=0,Y=({}.toString,function(a,b){ca[X]=a,ca[X+1]=b,X+=2,2===X&&(U?U(p):V())}),Z="undefined"!=typeof window?window:void 0,$=Z||{},_=$.MutationObserver||$.WebKitMutationObserver,aa="undefined"!=typeof d&&"[object process]"==={}.toString.call(d),ba="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,ca=new Array(1e3);V=aa?k():_?m():ba?n():void 0===Z&&"function"==typeof b?q():o();var da=void 0,ea=1,fa=2,ga=new F,ha=new F;J.prototype._validateInput=function(a){return W(a)},J.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")},J.prototype._init=function(){this._result=new Array(this.length)};var ia=J;J.prototype._enumerate=function(){for(var a=this,b=a.length,c=a.promise,d=a._input,e=0;c._state===da&&e<b;e++)a._eachEntry(d[e],e)},J.prototype._eachEntry=function(a,b){var c=this,d=c._instanceConstructor;h(a)?a.constructor===d&&a._state!==da?(a._onerror=null,c._settledAt(a._state,b,a._result)):c._willSettleAt(d.resolve(a),b):(c._remaining--,c._result[b]=a)},J.prototype._settledAt=function(a,b,c){var d=this,e=d.promise;e._state===da&&(d._remaining--,a===fa?C(e,c):d._result[b]=c),0===d._remaining&&B(e,d._result)},J.prototype._willSettleAt=function(a,b){var c=this;D(a,void 0,function(a){c._settledAt(ea,b,a)},function(a){c._settledAt(fa,b,a)})};var ja=K,ka=L,la=M,ma=N,na=0,oa=Q;Q.all=ja,Q.race=ka,Q.resolve=la,Q.reject=ma,Q._setScheduler=i,Q._setAsap=j,Q._asap=Y,Q.prototype={constructor:Q,then:function(a,b){var c=this,d=c._state;if(d===ea&&!a||d===fa&&!b)return this;var e=new this.constructor(r),f=c._result;if(d){var g=arguments[d-1];Y(function(){H(d,e,g,f)})}else D(c,e,a,b);return e},catch:function(a){return this.then(null,a)}};var pa=R,qa={Promise:oa,polyfill:pa};"function"==typeof a&&a.amd?a(function(){return qa}):"undefined"!=typeof c&&c.exports?c.exports=qa:"undefined"!=typeof this&&(this.ES6Promise=qa),pa()}).call(this)}).call(this,b("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:4}],4:[function(a,b,c){function d(){throw new Error("setTimeout has not been defined")}function e(){throw new Error("clearTimeout has not been defined")}function f(a){if(l===setTimeout)return setTimeout(a,0);if((l===d||!l)&&setTimeout)return l=setTimeout,setTimeout(a,0);try{return l(a,0)}catch(b){try{return l.call(null,a,0)}catch(b){return l.call(this,a,0)}}}function g(a){if(m===clearTimeout)return clearTimeout(a);if((m===e||!m)&&clearTimeout)return m=clearTimeout,clearTimeout(a);try{return m(a)}catch(b){try{return m.call(null,a)}catch(b){return m.call(this,a)}}}function h(){q&&o&&(q=!1,o.length?p=o.concat(p):r=-1,p.length&&i())}function i(){if(!q){var a=f(h);q=!0;for(var b=p.length;b;){for(o=p,p=[];++r<b;)o&&o[r].run();r=-1,b=p.length}o=null,q=!1,g(a)}}function j(a,b){this.fun=a,this.array=b}function k(){}var l,m,n=b.exports={};!function(){try{l="function"==typeof setTimeout?setTimeout:d}catch(a){l=d}try{m="function"==typeof clearTimeout?clearTimeout:e}catch(a){m=e}}();var o,p=[],q=!1,r=-1;n.nextTick=function(a){var b=new Array(arguments.length-1);if(arguments.length>1)for(var c=1;c<arguments.length;c++)b[c-1]=arguments[c];p.push(new j(a,b)),1!==p.length||q||f(i)},j.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=k,n.addListener=k,n.once=k,n.off=k,n.removeListener=k,n.removeAllListeners=k,n.emit=k,n.binding=function(a){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(a){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}},{}]},{},[1])(1)}); |
@@ -0,3 +1,4 @@ | ||
'use strict'; | ||
let ES6Promise = require('es6-promise').Promise; | ||
let generate = require('./promish-class'); | ||
module.exports = generate(ES6Promise); |
@@ -0,1 +1,2 @@ | ||
'use strict'; | ||
function generatePromish(Base) { | ||
@@ -2,0 +3,0 @@ function isErrorClass(type) { |
{ | ||
"name": "promish", | ||
"version": "5.0.1", | ||
"version": "5.0.2", | ||
"description": "ES6 Promise Shim", | ||
@@ -5,0 +5,0 @@ "private": false, |
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
105738
1988