angular-extend-promises
Advanced tools
Comparing version 1.0.0-beta.9 to 1.0.0-beta.10
/*! | ||
* angular-extend-promises v1.0.0-beta.9 - 2014-08-24 | ||
* angular-extend-promises v1.0.0-beta.10 - 2014-11-22 | ||
* (c) 2014 L.systems SARL, Etienne Folio, Quentin Raynaud | ||
@@ -124,2 +124,13 @@ * https://bitbucket.org/lsystems/angular-extend-promises | ||
module.exports = function(userFn) { | ||
var promise = module.exports.defer(); | ||
try { | ||
userFn(promise.resolve, promise.reject); | ||
} | ||
catch (e) { | ||
promise.reject(e); | ||
} | ||
return promise; | ||
}; | ||
_.extend(module.exports, { | ||
@@ -608,2 +619,4 @@ // Methods & aliases | ||
function Promise($qPromise, parent) { | ||
defineProperty(this, '$$state', $qPromise.$$state); | ||
_.each(_.methods($qPromise), function(name) { | ||
@@ -1016,3 +1029,3 @@ defineProperty(this, '$$' + name, $qPromise[name]); | ||
// convert the promise to newQ | ||
return decorate(this.$$then.apply(null, bindMethods.call(this, arguments)), this); | ||
return decorate(this.$$then.apply(this, bindMethods.call(this, arguments)), this); | ||
}; | ||
@@ -1019,0 +1032,0 @@ |
/*! | ||
* angular-extend-promises v1.0.0-beta.9 - 2014-08-24 | ||
* angular-extend-promises v1.0.0-beta.10 - 2014-11-22 | ||
* (c) 2014 L.systems SARL, Etienne Folio, Quentin Raynaud | ||
@@ -7,3 +7,3 @@ * https://bitbucket.org/lsystems/angular-extend-promises | ||
*/ | ||
!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n(function(){try{return require("../tmp/lodash")}catch(t){}}()):"function"==typeof define&&define.amd?define(["../tmp/lodash"],n):"object"==typeof exports?exports["angular-extend-promises"]=n(function(){try{return require("../tmp/lodash")}catch(t){}}()):t["angular-extend-promises"]=n(t["../tmp/lodash"])}(this,function(t){return function(t){function n(e){if(r[e])return r[e].exports;var o=r[e]={exports:{},id:e,loaded:!1};return t[e].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}var r={};return n.m=t,n.c=r,n.p="",n(0)}([function(t,n,r){"use strict";angular.module("angular-extend-promises",[]).provider("angularExtendPromises",function(){this.options={compatibilityAliases:!0,disableES5Methods:!1},this.$get=function(){return this.options}}).config(["$provide",function(t){if(angular.mock)for(var n in r.c)delete r.c[n];t.decorator("$q",["$delegate","angularExtendPromises",function(t,n){var e=r(1);return e.$delegate=t,e.$options=n,r(2)}])}])},function(t,n,r){"use strict";var e=r(3);e.extend(t.exports,{$defer:e.noop(),$delegate:{},$options:{}})},function(t,n,r){"use strict";var e=r(3),o=r(1),i=r(4);e.extend(t.exports,{all:r(5),any:r(6),bind:r(7),defer:r(8),each:r(9),filter:r(10),map:r(11),join:r(12),method:r(13),props:r(14),reduce:r(15),reject:r(16),resolve:r(17),some:r(18),when:r(19),AggregateError:i.AggregateError,TimeoutError:i.TimeoutError}),o.$options.compatibilityAliases&&e.extend(t.exports,{attempt:r(20)}),o.$options.disableES5Methods||e.extend(t.exports,{"try":r(20)})},function(t,n,r){"use strict";try{t.exports=r(21)}catch(e){t.exports=_}},function(t){"use strict";var n=t.exports.NewQError=function(t){this.name=this.constructor.name,Error.apply(this,arguments),this.message=t,Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack};n.prototype.toString=function(){return this.stack.toString()},n.subError=function(t,r){function e(){}r=r||n,e.prototype=r.prototype,t.prototype=new e,t.prototype.constructor=t,t.subError||(t.subError=function(r){n.subError(r,t)})},n.subError(n,Error);var r=t.exports.AggregateError=function(){n.apply(this,arguments)};n.subError(r);var e=t.exports.TimeoutError=function(){n.apply(this,arguments)};n.subError(e)},function(t,n,r){"use strict";var e=r(3),o=r(24),i=r(1),u=r(2);t.exports=function(t){return e.isArray(t)?(t=e.map(t,function(t){return u.when(t)}),o(i.$delegate.all(t))):u.props(t)}},function(t,n,r){"use strict";var e=r(2);t.exports=function(t){return e.some(t,1).get(0)}},function(t,n,r){"use strict";var e=r(2);t.exports=function(t){return e.resolve().bind(t)}},function(t,n,r){"use strict";var e=r(24),o=r(1);o.$defer=function(t){var n=o.$delegate.defer();return n.promise=e(n.promise,t),n},t.exports=function(){return o.$defer()}},function(t,n,r){"use strict";var e=r(22);t.exports=e("tap")},function(t,n,r){"use strict";var e=r(3),o=r(2);t.exports=function(t,n,r){return o.map(t,function(t){return o.props({val:t,toFilter:n.apply(null,arguments)})},r).then(function(t){return e.map(e.filter(t,"toFilter"),"val")})}},function(t,n,r){"use strict";var e=r(22);t.exports=e("then")},function(t,n,r){"use strict";var e=r(3),o=r(2);t.exports=function(){var t=e.toArray(arguments),n=t.pop();return o.all(t).spread(n)}},function(t,n,r){"use strict";var e=r(20);t.exports=function(t){return function(){return e(t,arguments,this)}}},function(t,n,r){"use strict";var e=r(3),o=r(2);t.exports=function(t){return o.all(e.values(t)).then(function(n){return e.object(e.keys(t),n)})}},function(t,n,r){"use strict";var e=r(3),o=r(2);t.exports=function(t,n,r){return e.reduce(t,function(r,e,i){return o.join(r,e,function(r,e){return n(r,e,i,t.length)})},o.resolve(r))}},function(t,n,r){"use strict";var e=r(23);t.exports=e("reject")},function(t,n,r){"use strict";var e=r(2),o=r(23);t.exports=o("resolve")||function(t){var n=e.defer();return n.resolve(t),n.promise}},function(t,n,r){"use strict";var e=r(3),o=r(2),i=r(4).AggregateError;t.exports=function(t,n){if(t.length<n)return o.reject(new i("initial array length ("+t.length+") > count ("+n+")"));var r=0,u=[],s=o.defer();return e.each(t,function(e){o.when(e).tap(function(t){null!==u&&(u.push(t),u.length>=n&&(s.resolve(u),u=null))}).$$catch(function(){null!==u&&(++r,t.length-r<n&&(s.reject(new i("Cannot resolve promise: too many rejections ("+r+")")),u=null))})}),s.promise}},function(t,n,r){"use strict";var e=r(23);t.exports=e("when")},function(t,n,r){"use strict";var e=r(3),o=r(2);t.exports=function(t,n,r){try{return e.isEmpty(n)||e.isArray(n)||(n=[n]),o.when(t.apply(r||this,n))}catch(i){return o.reject(i)}}},function(n){if("undefined"==typeof t){var r=new Error('Cannot find module "../tmp/lodash"');throw r.code="MODULE_NOT_FOUND",r}n.exports=t},function(t,n,r){"use strict";var e=r(3),o=r(2),i=r(25),u=r(26);t.exports=function(t){return function(n,r,s){s=e.pick(s,"concurrency");var c=s.concurrency?new i(s):{add:function(t){return t()}},a=e.map(n,function(e,i){return o.when(e)[t](function(t){return c.add(function(){return o.when(r.call(null,t,i,n.length))})})}),l=o.all(a);return u(l,"$$unsynced",a),l}}},function(t,n,r){"use strict";var e=r(24),o=r(1);t.exports=function(t){return t in o.$delegate?function(){return e(o.$delegate[t].apply(o.$delegate,arguments))}:null}},function(t,n,r){"use strict";function e(t,n){o.each(o.methods(t),function(n){s(this,"$$"+n,t[n])},this),n&&n.$$boundTo&&s(this,"$$boundTo",n.$$boundTo),s(this,"$$arrayListeners",[]),this.then=t.then=this.then.bind(this)}var o=r(3),i=r(1),u=r(27),s=r(26),c={"catch":"caught","finally":"lastly","return":["thenReturn","returns"],"throw":["thenThrow"]};t.exports=function(t,n){return new e(t,n)},e.prototype={all:u("all"),any:u("any"),bind:r(28),call:r(29),"catch":r(30),delay:r(31),done:r(32),each:u("each"),filter:u("filter"),"finally":function(){return this.$$finally.apply(this,arguments)},get:r(33),map:u("map"),nodeify:r(34),props:u("props"),reduce:u("reduce"),"return":r(35),some:u("some"),spread:r(36),tap:r(37),then:r(38),"throw":r(39),timeout:r(40),constructor:e},s(e.prototype,"$$callArrayListeners",function(t){o.each(this.$$arrayListeners,function(n){n(t)})}),o.each(c,function(t,n){o.isArray(t)||(t=[t]),i.$options.compatibilityAliases&&o.each(t,function(t){e.prototype[t]=e.prototype[n]}),i.$options.disableES5Methods&&delete e.prototype[n]})},function(t,n,r){"use strict";var e=r(3),o=r(1),i=t.exports=function(t){this.$options=e.defaults(t,{concurrency:1,maxQueue:0}),this.$fns=[]};i.prototype.add=function(t){var n=o.$defer(),r=function(){t()["finally"](function(){this.$fns.splice(this.$fns.indexOf(r),1),this.$fns.length>=this.$options.concurrency&&this.$fns[this.$options.concurrency-1]()}.bind(this)).then(function(t){n.resolve(t)},function(t){n.reject(t)})}.bind(this);return this.$fns.push(r)<=this.$options.concurrency&&r(),n.promise}},function(t){"use strict";t.exports=function(t,n,r){if(Object.defineProperty)try{Object.defineProperty(t,n,{value:r})}catch(e){}t[n]!==r&&(t[n]=r)}},function(t,n,r){"use strict";var e=r(41),o=r(2),i=r(26);t.exports=function(t){function n(n,r){var e=o[t].apply(null,[r].concat(n));return i(e,"$$boundTo",this.$$boundTo),e}return function(){var t=e.call(this,arguments);if(this.$$unsynced)return n.call(this,t,this.$$unsynced);var r=this.then(function(e){if(r.$$promiseResult)return r.$$promiseResult;var o=n.call(this,t,e);return r.$$arrayListeners.length&&o.$$unsynced&&r.$$callArrayListeners(o.$$unsynced),o}.bind(this));return this.$$arrayListeners.push(function(e){i(this,"$$promiseResult",n.call(this,t,e)),r.$$arrayListeners.length&&this.$$promiseResult.$$unsynced&&r.$$callArrayListeners(this.$$promiseResult.$$unsynced)}.bind(this)),r}}},function(t,n,r){"use strict";var e=r(26);t.exports=function(t){return e(this,"$$boundTo",t),this}},function(t,n,r){"use strict";var e=r(3);t.exports=function(){var t=e.toArray(arguments),n=t.shift();return this.then(function(r){return r[n].apply(r,t)})}},function(t,n,r){"use strict";function e(t,n){var r=!t.length;return i.each(t,function(t){if(!i.isFunction(t))throw new Error("Invalid argument.");return t instanceof Error||t.prototype instanceof Error?(r=r||n instanceof t,!r):(r=r||t(n),!r)}),r}var o=r(2),i=r(3);t.exports=function(){var t=i.toArray(arguments),n=t.pop();return this.$$catch(function(r){return i.isFunction(n)&&e(t,r)?n.call(this,r):o.reject(r)})}},function(t,n,r){"use strict";var e=r(1);t.exports=function(t){return this.then(function(n){var r=e.$defer(this);return setTimeout(r.resolve,t,n),r.promise}.bind(this))}},function(t,n,r){"use strict";var e=r(2);t.exports=function(){return this.then.apply(this,arguments).$$catch(function(t){setTimeout(function(){throw t})}).$$finally(function(){return e.reject(new Error("Do not chain anything after calling done()!"))})}},function(t){"use strict";t.exports=function(t){return this.then(function(n){return n[t]})}},function(t,n,r){"use strict";var e=r(3),o=r(2);t.exports=function(t,n){return t=t||e.noop,n=n||{},this.then(function(r){var o=r;return o=n.spread&&e.isArray(o)?[null].concat(o):[null,o],t.apply(this,o),r},function(n){return t.call(this,n),o.reject(n)})}},function(t,n,r){"use strict";var e=r(3);t.exports=function(t){return this.then(e.constant(t))}},function(t,n,r){"use strict";var e=r(3);t.exports=function(t){return this.then(function(n){return e.isArray(n)||(n=[n]),t.apply(this,n)})}},function(t,n,r){"use strict";var e=r(2);t.exports=function(t){return this.then(function(n){return e.when(t.call(this,n)).returns(n)})}},function(t,n,r){"use strict";var e=r(41),o=r(24);t.exports=function(){return o(this.$$then.apply(null,e.call(this,arguments)),this)}},function(t,n,r){"use strict";var e=r(2);t.exports=function(t){return this.then(function(){return e.reject(t)})}},function(t,n,r){"use strict";var e=r(1),o=r(2);t.exports=function(t,n){var r=e.$defer(this),i=setTimeout(function(){r.reject(new o.TimeoutError(n||"Timed out after "+t+" ms"))},t);return this.then(function(t){r.resolve(t)},function(t){r.reject(t)})["finally"](clearTimeout.bind(null,i)),r.promise}},function(t,n,r){"use strict";var e=r(3);t.exports=function(t){return e.map(t,function(t){return e.isFunction(t)?t.bind(this.$$boundTo||this):t},this)}}])}); | ||
!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n(function(){try{return require("../tmp/lodash")}catch(t){}}()):"function"==typeof define&&define.amd?define(["../tmp/lodash"],n):"object"==typeof exports?exports["angular-extend-promises"]=n(function(){try{return require("../tmp/lodash")}catch(t){}}()):t["angular-extend-promises"]=n(t["../tmp/lodash"])}(this,function(t){return function(t){function n(e){if(r[e])return r[e].exports;var o=r[e]={exports:{},id:e,loaded:!1};return t[e].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}var r={};return n.m=t,n.c=r,n.p="",n(0)}([function(t,n,r){"use strict";angular.module("angular-extend-promises",[]).provider("angularExtendPromises",function(){this.options={compatibilityAliases:!0,disableES5Methods:!1},this.$get=function(){return this.options}}).config(["$provide",function(t){if(angular.mock)for(var n in r.c)delete r.c[n];t.decorator("$q",["$delegate","angularExtendPromises",function(t,n){var e=r(1);return e.$delegate=t,e.$options=n,r(2)}])}])},function(t,n,r){"use strict";var e=r(3);e.extend(t.exports,{$defer:e.noop(),$delegate:{},$options:{}})},function(t,n,r){"use strict";var e=r(3),o=r(1),i=r(4);t.exports=function(n){var r=t.exports.defer();try{n(r.resolve,r.reject)}catch(e){r.reject(e)}return r},e.extend(t.exports,{all:r(5),any:r(6),bind:r(7),defer:r(8),each:r(9),filter:r(10),map:r(11),join:r(12),method:r(13),props:r(14),reduce:r(15),reject:r(16),resolve:r(17),some:r(18),when:r(19),AggregateError:i.AggregateError,TimeoutError:i.TimeoutError}),o.$options.compatibilityAliases&&e.extend(t.exports,{attempt:r(20)}),o.$options.disableES5Methods||e.extend(t.exports,{"try":r(20)})},function(t,n,r){"use strict";try{t.exports=r(21)}catch(e){t.exports=_}},function(t){"use strict";var n=t.exports.NewQError=function(t){this.name=this.constructor.name,Error.apply(this,arguments),this.message=t,Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack};n.prototype.toString=function(){return this.stack.toString()},n.subError=function(t,r){function e(){}r=r||n,e.prototype=r.prototype,t.prototype=new e,t.prototype.constructor=t,t.subError||(t.subError=function(r){n.subError(r,t)})},n.subError(n,Error);var r=t.exports.AggregateError=function(){n.apply(this,arguments)};n.subError(r);var e=t.exports.TimeoutError=function(){n.apply(this,arguments)};n.subError(e)},function(t,n,r){"use strict";var e=r(3),o=r(24),i=r(1),s=r(2);t.exports=function(t){return e.isArray(t)?(t=e.map(t,function(t){return s.when(t)}),o(i.$delegate.all(t))):s.props(t)}},function(t,n,r){"use strict";var e=r(2);t.exports=function(t){return e.some(t,1).get(0)}},function(t,n,r){"use strict";var e=r(2);t.exports=function(t){return e.resolve().bind(t)}},function(t,n,r){"use strict";var e=r(24),o=r(1);o.$defer=function(t){var n=o.$delegate.defer();return n.promise=e(n.promise,t),n},t.exports=function(){return o.$defer()}},function(t,n,r){"use strict";var e=r(22);t.exports=e("tap")},function(t,n,r){"use strict";var e=r(3),o=r(2);t.exports=function(t,n,r){return o.map(t,function(t){return o.props({val:t,toFilter:n.apply(null,arguments)})},r).then(function(t){return e.map(e.filter(t,"toFilter"),"val")})}},function(t,n,r){"use strict";var e=r(22);t.exports=e("then")},function(t,n,r){"use strict";var e=r(3),o=r(2);t.exports=function(){var t=e.toArray(arguments),n=t.pop();return o.all(t).spread(n)}},function(t,n,r){"use strict";var e=r(20);t.exports=function(t){return function(){return e(t,arguments,this)}}},function(t,n,r){"use strict";var e=r(3),o=r(2);t.exports=function(t){return o.all(e.values(t)).then(function(n){return e.object(e.keys(t),n)})}},function(t,n,r){"use strict";var e=r(3),o=r(2);t.exports=function(t,n,r){return e.reduce(t,function(r,e,i){return o.join(r,e,function(r,e){return n(r,e,i,t.length)})},o.resolve(r))}},function(t,n,r){"use strict";var e=r(23);t.exports=e("reject")},function(t,n,r){"use strict";var e=r(2),o=r(23);t.exports=o("resolve")||function(t){var n=e.defer();return n.resolve(t),n.promise}},function(t,n,r){"use strict";var e=r(3),o=r(2),i=r(4).AggregateError;t.exports=function(t,n){if(t.length<n)return o.reject(new i("initial array length ("+t.length+") > count ("+n+")"));var r=0,s=[],u=o.defer();return e.each(t,function(e){o.when(e).tap(function(t){null!==s&&(s.push(t),s.length>=n&&(u.resolve(s),s=null))}).$$catch(function(){null!==s&&(++r,t.length-r<n&&(u.reject(new i("Cannot resolve promise: too many rejections ("+r+")")),s=null))})}),u.promise}},function(t,n,r){"use strict";var e=r(23);t.exports=e("when")},function(t,n,r){"use strict";var e=r(3),o=r(2);t.exports=function(t,n,r){try{return e.isEmpty(n)||e.isArray(n)||(n=[n]),o.when(t.apply(r||this,n))}catch(i){return o.reject(i)}}},function(n){if("undefined"==typeof t){var r=new Error('Cannot find module "../tmp/lodash"');throw r.code="MODULE_NOT_FOUND",r}n.exports=t},function(t,n,r){"use strict";var e=r(3),o=r(2),i=r(25),s=r(26);t.exports=function(t){return function(n,r,u){u=e.pick(u,"concurrency");var c=u.concurrency?new i(u):{add:function(t){return t()}},a=e.map(n,function(e,i){return o.when(e)[t](function(t){return c.add(function(){return o.when(r.call(null,t,i,n.length))})})}),l=o.all(a);return s(l,"$$unsynced",a),l}}},function(t,n,r){"use strict";var e=r(24),o=r(1);t.exports=function(t){return t in o.$delegate?function(){return e(o.$delegate[t].apply(o.$delegate,arguments))}:null}},function(t,n,r){"use strict";function e(t,n){u(this,"$$state",t.$$state),o.each(o.methods(t),function(n){u(this,"$$"+n,t[n])},this),n&&n.$$boundTo&&u(this,"$$boundTo",n.$$boundTo),u(this,"$$arrayListeners",[]),this.then=t.then=this.then.bind(this)}var o=r(3),i=r(1),s=r(27),u=r(26),c={"catch":"caught","finally":"lastly","return":["thenReturn","returns"],"throw":["thenThrow"]};t.exports=function(t,n){return new e(t,n)},e.prototype={all:s("all"),any:s("any"),bind:r(28),call:r(29),"catch":r(30),delay:r(31),done:r(32),each:s("each"),filter:s("filter"),"finally":function(){return this.$$finally.apply(this,arguments)},get:r(33),map:s("map"),nodeify:r(34),props:s("props"),reduce:s("reduce"),"return":r(35),some:s("some"),spread:r(36),tap:r(37),then:r(38),"throw":r(39),timeout:r(40),constructor:e},u(e.prototype,"$$callArrayListeners",function(t){o.each(this.$$arrayListeners,function(n){n(t)})}),o.each(c,function(t,n){o.isArray(t)||(t=[t]),i.$options.compatibilityAliases&&o.each(t,function(t){e.prototype[t]=e.prototype[n]}),i.$options.disableES5Methods&&delete e.prototype[n]})},function(t,n,r){"use strict";var e=r(3),o=r(1),i=t.exports=function(t){this.$options=e.defaults(t,{concurrency:1,maxQueue:0}),this.$fns=[]};i.prototype.add=function(t){var n=o.$defer(),r=function(){t()["finally"](function(){this.$fns.splice(this.$fns.indexOf(r),1),this.$fns.length>=this.$options.concurrency&&this.$fns[this.$options.concurrency-1]()}.bind(this)).then(function(t){n.resolve(t)},function(t){n.reject(t)})}.bind(this);return this.$fns.push(r)<=this.$options.concurrency&&r(),n.promise}},function(t){"use strict";t.exports=function(t,n,r){if(Object.defineProperty)try{Object.defineProperty(t,n,{value:r})}catch(e){}t[n]!==r&&(t[n]=r)}},function(t,n,r){"use strict";var e=r(41),o=r(2),i=r(26);t.exports=function(t){function n(n,r){var e=o[t].apply(null,[r].concat(n));return i(e,"$$boundTo",this.$$boundTo),e}return function(){var t=e.call(this,arguments);if(this.$$unsynced)return n.call(this,t,this.$$unsynced);var r=this.then(function(e){if(r.$$promiseResult)return r.$$promiseResult;var o=n.call(this,t,e);return r.$$arrayListeners.length&&o.$$unsynced&&r.$$callArrayListeners(o.$$unsynced),o}.bind(this));return this.$$arrayListeners.push(function(e){i(this,"$$promiseResult",n.call(this,t,e)),r.$$arrayListeners.length&&this.$$promiseResult.$$unsynced&&r.$$callArrayListeners(this.$$promiseResult.$$unsynced)}.bind(this)),r}}},function(t,n,r){"use strict";var e=r(26);t.exports=function(t){return e(this,"$$boundTo",t),this}},function(t,n,r){"use strict";var e=r(3);t.exports=function(){var t=e.toArray(arguments),n=t.shift();return this.then(function(r){return r[n].apply(r,t)})}},function(t,n,r){"use strict";function e(t,n){var r=!t.length;return i.each(t,function(t){if(!i.isFunction(t))throw new Error("Invalid argument.");return t instanceof Error||t.prototype instanceof Error?(r=r||n instanceof t,!r):(r=r||t(n),!r)}),r}var o=r(2),i=r(3);t.exports=function(){var t=i.toArray(arguments),n=t.pop();return this.$$catch(function(r){return i.isFunction(n)&&e(t,r)?n.call(this,r):o.reject(r)})}},function(t,n,r){"use strict";var e=r(1);t.exports=function(t){return this.then(function(n){var r=e.$defer(this);return setTimeout(r.resolve,t,n),r.promise}.bind(this))}},function(t,n,r){"use strict";var e=r(2);t.exports=function(){return this.then.apply(this,arguments).$$catch(function(t){setTimeout(function(){throw t})}).$$finally(function(){return e.reject(new Error("Do not chain anything after calling done()!"))})}},function(t){"use strict";t.exports=function(t){return this.then(function(n){return n[t]})}},function(t,n,r){"use strict";var e=r(3),o=r(2);t.exports=function(t,n){return t=t||e.noop,n=n||{},this.then(function(r){var o=r;return o=n.spread&&e.isArray(o)?[null].concat(o):[null,o],t.apply(this,o),r},function(n){return t.call(this,n),o.reject(n)})}},function(t,n,r){"use strict";var e=r(3);t.exports=function(t){return this.then(e.constant(t))}},function(t,n,r){"use strict";var e=r(3);t.exports=function(t){return this.then(function(n){return e.isArray(n)||(n=[n]),t.apply(this,n)})}},function(t,n,r){"use strict";var e=r(2);t.exports=function(t){return this.then(function(n){return e.when(t.call(this,n)).returns(n)})}},function(t,n,r){"use strict";var e=r(41),o=r(24);t.exports=function(){return o(this.$$then.apply(this,e.call(this,arguments)),this)}},function(t,n,r){"use strict";var e=r(2);t.exports=function(t){return this.then(function(){return e.reject(t)})}},function(t,n,r){"use strict";var e=r(1),o=r(2);t.exports=function(t,n){var r=e.$defer(this),i=setTimeout(function(){r.reject(new o.TimeoutError(n||"Timed out after "+t+" ms"))},t);return this.then(function(t){r.resolve(t)},function(t){r.reject(t)})["finally"](clearTimeout.bind(null,i)),r.promise}},function(t,n,r){"use strict";var e=r(3);t.exports=function(t){return e.map(t,function(t){return e.isFunction(t)?t.bind(this.$$boundTo||this):t},this)}}])}); | ||
//# sourceMappingURL=angular-extend-promises-without-lodash.min.js.map |
/*! | ||
* angular-extend-promises v1.0.0-beta.9 - 2014-08-24 | ||
* angular-extend-promises v1.0.0-beta.10 - 2014-11-22 | ||
* (c) 2014 L.systems SARL, Etienne Folio, Quentin Raynaud | ||
@@ -7,3 +7,3 @@ * https://bitbucket.org/lsystems/angular-extend-promises | ||
*/ | ||
!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):"object"==typeof exports?exports["angular-extend-promises"]=n():t["angular-extend-promises"]=n()}(this,function(){return function(t){function n(e){if(r[e])return r[e].exports;var o=r[e]={exports:{},id:e,loaded:!1};return t[e].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}var r={};return n.m=t,n.c=r,n.p="",n(0)}([function(t,n,r){"use strict";angular.module("angular-extend-promises",[]).provider("angularExtendPromises",function(){this.options={compatibilityAliases:!0,disableES5Methods:!1},this.$get=function(){return this.options}}).config(["$provide",function(t){if(angular.mock)for(var n in r.c)delete r.c[n];t.decorator("$q",["$delegate","angularExtendPromises",function(t,n){var e=r(1);return e.$delegate=t,e.$options=n,r(2)}])}])},function(t,n,r){"use strict";var e=r(3);e.extend(t.exports,{$defer:e.noop(),$delegate:{},$options:{}})},function(t,n,r){"use strict";var e=r(3),o=r(1),i=r(4);e.extend(t.exports,{all:r(5),any:r(6),bind:r(7),defer:r(8),each:r(9),filter:r(10),map:r(11),join:r(12),method:r(13),props:r(14),reduce:r(15),reject:r(16),resolve:r(17),some:r(18),when:r(19),AggregateError:i.AggregateError,TimeoutError:i.TimeoutError}),o.$options.compatibilityAliases&&e.extend(t.exports,{attempt:r(20)}),o.$options.disableES5Methods||e.extend(t.exports,{"try":r(20)})},function(t,n,r){"use strict";try{t.exports=r(21)}catch(e){t.exports=_}},function(t){"use strict";var n=t.exports.NewQError=function(t){this.name=this.constructor.name,Error.apply(this,arguments),this.message=t,Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack};n.prototype.toString=function(){return this.stack.toString()},n.subError=function(t,r){function e(){}r=r||n,e.prototype=r.prototype,t.prototype=new e,t.prototype.constructor=t,t.subError||(t.subError=function(r){n.subError(r,t)})},n.subError(n,Error);var r=t.exports.AggregateError=function(){n.apply(this,arguments)};n.subError(r);var e=t.exports.TimeoutError=function(){n.apply(this,arguments)};n.subError(e)},function(t,n,r){"use strict";var e=r(3),o=r(24),i=r(1),u=r(2);t.exports=function(t){return e.isArray(t)?(t=e.map(t,function(t){return u.when(t)}),o(i.$delegate.all(t))):u.props(t)}},function(t,n,r){"use strict";var e=r(2);t.exports=function(t){return e.some(t,1).get(0)}},function(t,n,r){"use strict";var e=r(2);t.exports=function(t){return e.resolve().bind(t)}},function(t,n,r){"use strict";var e=r(24),o=r(1);o.$defer=function(t){var n=o.$delegate.defer();return n.promise=e(n.promise,t),n},t.exports=function(){return o.$defer()}},function(t,n,r){"use strict";var e=r(22);t.exports=e("tap")},function(t,n,r){"use strict";var e=r(3),o=r(2);t.exports=function(t,n,r){return o.map(t,function(t){return o.props({val:t,toFilter:n.apply(null,arguments)})},r).then(function(t){return e.map(e.filter(t,"toFilter"),"val")})}},function(t,n,r){"use strict";var e=r(22);t.exports=e("then")},function(t,n,r){"use strict";var e=r(3),o=r(2);t.exports=function(){var t=e.toArray(arguments),n=t.pop();return o.all(t).spread(n)}},function(t,n,r){"use strict";var e=r(20);t.exports=function(t){return function(){return e(t,arguments,this)}}},function(t,n,r){"use strict";var e=r(3),o=r(2);t.exports=function(t){return o.all(e.values(t)).then(function(n){return e.object(e.keys(t),n)})}},function(t,n,r){"use strict";var e=r(3),o=r(2);t.exports=function(t,n,r){return e.reduce(t,function(r,e,i){return o.join(r,e,function(r,e){return n(r,e,i,t.length)})},o.resolve(r))}},function(t,n,r){"use strict";var e=r(23);t.exports=e("reject")},function(t,n,r){"use strict";var e=r(2),o=r(23);t.exports=o("resolve")||function(t){var n=e.defer();return n.resolve(t),n.promise}},function(t,n,r){"use strict";var e=r(3),o=r(2),i=r(4).AggregateError;t.exports=function(t,n){if(t.length<n)return o.reject(new i("initial array length ("+t.length+") > count ("+n+")"));var r=0,u=[],s=o.defer();return e.each(t,function(e){o.when(e).tap(function(t){null!==u&&(u.push(t),u.length>=n&&(s.resolve(u),u=null))}).$$catch(function(){null!==u&&(++r,t.length-r<n&&(s.reject(new i("Cannot resolve promise: too many rejections ("+r+")")),u=null))})}),s.promise}},function(t,n,r){"use strict";var e=r(23);t.exports=e("when")},function(t,n,r){"use strict";var e=r(3),o=r(2);t.exports=function(t,n,r){try{return e.isEmpty(n)||e.isArray(n)||(n=[n]),o.when(t.apply(r||this,n))}catch(i){return o.reject(i)}}},function(t,n,r){var e;(function(t,o){(function(){function i(){return H.pop()||[]}function u(t){t.length=0,H.length<Q&&H.push(t)}function s(t,n,r){n||(n=0),"undefined"==typeof r&&(r=t?t.length:0);for(var e=-1,o=r-n||0,i=Array(0>o?0:o);++e<o;)i[e]=t[n+e];return i}function a(){}function c(t){function n(){if(e){var t=s(e);bn.apply(t,arguments)}if(this instanceof n){var i=l(r.prototype),u=r.apply(i,t||arguments);return j(u)?u:i}return r.apply(o,t||arguments)}var r=t[0],e=t[2],o=t[4];return An(n,t),n}function l(t){return j(t)?$n(t):{}}function f(t,n,r){if("function"!=typeof t)return R;if("undefined"==typeof n||!("prototype"in t))return t;var e=t.__bindData__;if("undefined"==typeof e&&(kn.funcNames&&(e=!t.name),e=e||!kn.funcDecomp,!e)){var o=yn.call(t);kn.funcNames||(e=!q.test(o)),e||(e=z.test(o),An(t,e))}if(e===!1||e!==!0&&1&e[1])return t;switch(r){case 1:return function(r){return t.call(n,r)};case 2:return function(r,e){return t.call(n,r,e)};case 3:return function(r,e,o){return t.call(n,r,e,o)};case 4:return function(r,e,o,i){return t.call(n,r,e,o,i)}}return L(t,n)}function p(t){function n(){var t=c?u:this;if(o){var d=s(o);bn.apply(d,arguments)}if((i||h)&&(d||(d=s(arguments)),i&&bn.apply(d,i),h&&d.length<a))return e|=16,p([r,g?e:-4&e,d,null,u,a]);if(d||(d=arguments),f&&(r=t[y]),this instanceof n){t=l(r.prototype);var b=r.apply(t,d);return j(b)?b:t}return r.apply(t,d)}var r=t[0],e=t[1],o=t[2],i=t[3],u=t[4],a=t[5],c=1&e,f=2&e,h=4&e,g=8&e,y=r;return An(n,t),n}function h(t,n,r,e){for(var o=(e||0)-1,i=t?t.length:0,u=[];++o<i;){var s=t[o];if(s&&"object"==typeof s&&"number"==typeof s.length&&(On(s)||v(s))){n||(s=h(s,n,r));var a=-1,c=s.length,l=u.length;for(u.length+=c;++a<c;)u[l++]=s[a]}else r||u.push(s)}return u}function g(t,n,r,e,o,s){if(r){var a=r(t,n);if("undefined"!=typeof a)return!!a}if(t===n)return 0!==t||1/t==1/n;var c=typeof t,l=typeof n;if(!(t!==t||t&&en[c]||n&&en[l]))return!1;if(null==t||null==n)return t===n;var f=hn.call(t),p=hn.call(n);if(f==V&&(f=Y),p==V&&(p=Y),f!=p)return!1;switch(f){case G:case J:return+t==+n;case X:return t!=+t?n!=+n:0==t?1/t==1/n:t==+n;case Z:case tn:return t==String(n)}var h=f==W;if(!h){var y=dn.call(t,"__wrapped__"),d=dn.call(n,"__wrapped__");if(y||d)return g(y?t.__wrapped__:t,d?n.__wrapped__:n,r,e,o,s);if(f!=Y)return!1;var b=!kn.argsObject&&v(t)?Object:t.constructor,m=!kn.argsObject&&v(n)?Object:n.constructor;if(b!=m&&!($(b)&&b instanceof b&&$(m)&&m instanceof m)&&"constructor"in t&&"constructor"in n)return!1}var x=!o;o||(o=i()),s||(s=i());for(var j=o.length;j--;)if(o[j]==t)return s[j]==n;var w=0;if(a=!0,o.push(t),s.push(n),h){if(j=t.length,w=n.length,a=w==j,a||e)for(;w--;){var E=j,k=n[w];if(e)for(;E--&&!(a=g(t[E],k,r,e,o,s)););else if(!(a=g(t[w],k,r,e,o,s)))break}}else Nn(n,function(n,i,u){return dn.call(u,i)?(w++,a=dn.call(t,i)&&g(t[i],n,r,e,o,s)):void 0}),a&&!e&&Nn(t,function(t,n,r){return dn.call(r,n)?a=--w>-1:void 0});return o.pop(),s.pop(),x&&(u(o),u(s)),a}function y(t,n,r,e,o,i){var u=1&n,a=2&n,l=4&n,f=16&n,h=32&n;if(!a&&!$(t))throw new TypeError;f&&!r.length&&(n&=-17,f=r=!1),h&&!e.length&&(n&=-33,h=e=!1);var g=t&&t.__bindData__;if(g&&g!==!0)return g=s(g),g[2]&&(g[2]=s(g[2])),g[3]&&(g[3]=s(g[3])),!u||1&g[1]||(g[4]=o),!u&&1&g[1]&&(n|=8),!l||4&g[1]||(g[5]=i),f&&bn.apply(g[2]||(g[2]=[]),r),h&&mn.apply(g[3]||(g[3]=[]),e),g[1]|=n,y.apply(null,g);var d=1==n||17===n?c:p;return d([t,n,r,e,o,i])}function d(){rn.shadowedProps=B,rn.array=rn.bottom=rn.loop=rn.top="",rn.init="iterable",rn.useHas=!0;for(var t,n=0;t=arguments[n];n++)for(var r in t)rn[r]=t[r];var e=rn.args;rn.firstArg=/^[^,]+/.exec(e)[0];var o=Function("baseCreateCallback, errorClass, errorProto, hasOwnProperty, indicatorObject, isArguments, isArray, isString, keys, objectProto, objectTypes, nonEnumProps, stringClass, stringProto, toString","return function("+e+") {\n"+Pn(rn)+"\n}");return o(f,K,ln,dn,M,v,On,w,rn.keys,fn,en,En,tn,pn,hn)}function b(t){return"function"==typeof t&&gn.test(t)}function v(t){return t&&"object"==typeof t&&"number"==typeof t.length&&hn.call(t)==V||!1}function m(t){var n=[];return Nn(t,function(t,r){$(t)&&n.push(r)}),n.sort()}function x(t){var n=!0;if(!t)return n;var r=hn.call(t),e=t.length;return r==W||r==tn||(kn.argsClass?r==V:v(t))||r==Y&&"number"==typeof e&&$(t.splice)?!e:(Dn(t,function(){return n=!1}),n)}function $(t){return"function"==typeof t}function j(t){return!(!t||!en[typeof t])}function w(t){return"string"==typeof t||t&&"object"==typeof t&&hn.call(t)==tn||!1}function E(t,n,r){var e={};if("function"!=typeof n)for(var o=-1,i=h(arguments,!0,!1,1),u=j(t)?i.length:0;++o<u;){var s=i[o];s in t&&(e[s]=t[s])}else n=a.createCallback(n,r,3),Nn(t,function(t,r,o){n(t,r,o)&&(e[r]=t)});return e}function P(t){for(var n=-1,r=Sn(t),e=r.length,o=Array(e);++n<e;)o[n]=t[r[n]];return o}function A(t,n,r){var e=[];if(n=a.createCallback(n,r,3),On(t))for(var o=-1,i=t.length;++o<i;){var u=t[o];n(u,o,t)&&e.push(u)}else In(t,function(t,r,o){n(t,r,o)&&e.push(t)});return e}function O(t,n,r){if(n&&"undefined"==typeof r&&On(t))for(var e=-1,o=t.length;++e<o&&n(t[e],e,t)!==!1;);else In(t,n,r);return t}function _(t,n,r){var e=-1,o=t?t.length:0,i=Array("number"==typeof o?o:0);if(n=a.createCallback(n,r,3),On(t))for(;++e<o;)i[e]=n(t[e],e,t);else In(t,function(t,r,o){i[++e]=n(t,r,o)});return i}function S(t,n,r,e){var o=arguments.length<3;if(n=a.createCallback(n,e,4),On(t)){var i=-1,u=t.length;for(o&&(r=t[++i]);++i<u;)r=n(r,t[i],i,t)}else In(t,function(t,e,i){r=o?(o=!1,t):n(r,t,e,i)});return r}function T(t){return t&&"number"==typeof t.length?kn.unindexedChars&&w(t)?t.split(""):s(t):P(t)}function C(t,n){var r=-1,e=t?t.length:0,o={};for(n||!e||On(t[0])||(n=[]);++r<e;){var i=t[r];n?o[i]=n[r]:i&&(o[i[0]]=i[1])}return o}function L(t,n){return arguments.length>2?y(t,17,s(arguments,2),null,n):y(t,1,null,null,n)}function I(t){return function(){return t}}function F(t,n,r){var e=typeof t;if(null==t||"function"==e)return f(t,n,r);if("object"!=e)return D(t);var o=Sn(t),i=o[0],u=t[i];return 1!=o.length||u!==u||j(u)?function(n){for(var r=o.length,e=!1;r--&&(e=g(n[o[r]],t[o[r]],null,!0)););return e}:function(t){var n=t[i];return u===n&&(0!==u||1/u==1/n)}}function R(t){return t}function N(){}function D(t){return function(n){return n[t]}}var H=[],M={},Q=40,q=/^\s*function[ \n\r\t]+\w/,z=/\bthis\b/,B=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],V="[object Arguments]",W="[object Array]",G="[object Boolean]",J="[object Date]",K="[object Error]",U="[object Function]",X="[object Number]",Y="[object Object]",Z="[object RegExp]",tn="[object String]",nn={configurable:!1,enumerable:!1,value:null,writable:!1},rn={args:"",array:null,bottom:"",firstArg:"",init:"",keys:null,loop:"",shadowedProps:null,support:null,top:"",useHas:!1},en={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},on=en[typeof window]&&window||this,un=en[typeof n]&&n&&!n.nodeType&&n,sn=en[typeof t]&&t&&!t.nodeType&&t,an=(sn&&sn.exports===un&&un,en[typeof o]&&o);!an||an.global!==an&&an.window!==an||(on=an);var cn=[],ln=Error.prototype,fn=Object.prototype,pn=String.prototype,hn=fn.toString,gn=RegExp("^"+String(hn).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),yn=Function.prototype.toString,dn=fn.hasOwnProperty,bn=cn.push,vn=fn.propertyIsEnumerable,mn=cn.unshift,xn=function(){try{var t={},n=b(n=Object.defineProperty)&&n,r=n(t,t,t)&&n}catch(e){}return r}(),$n=b($n=Object.create)&&$n,jn=b(jn=Array.isArray)&&jn,wn=b(wn=Object.keys)&&wn,En={};En[W]=En[J]=En[X]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},En[G]=En[tn]={constructor:!0,toString:!0,valueOf:!0},En[K]=En[U]=En[Z]={constructor:!0,toString:!0},En[Y]={constructor:!0},function(){for(var t=B.length;t--;){var n=B[t];for(var r in En)dn.call(En,r)&&!dn.call(En[r],n)&&(En[r][n]=!1)}}();var kn=a.support={};!function(){var t=function(){this.x=1},n={0:1,length:1},r=[];t.prototype={valueOf:1,y:1};for(var e in new t)r.push(e);for(e in arguments);kn.argsClass=hn.call(arguments)==V,kn.argsObject=arguments.constructor==Object&&!(arguments instanceof Array),kn.enumErrorProps=vn.call(ln,"message")||vn.call(ln,"name"),kn.enumPrototypes=vn.call(t,"prototype"),kn.funcDecomp=!b(on.WinRTError)&&z.test(function(){return this}),kn.funcNames="string"==typeof Function.name,kn.nonEnumArgs=0!=e,kn.nonEnumShadows=!/valueOf/.test(r),kn.spliceObjects=(cn.splice.call(n,0,1),!n[0]),kn.unindexedChars="x"[0]+Object("x")[0]!="xx"}(1);var Pn=function(t){var n="var index, iterable = "+t.firstArg+", result = "+t.init+";\nif (!iterable) return result;\n"+t.top+";";t.array?(n+="\nvar length = iterable.length; index = -1;\nif ("+t.array+") { ",kn.unindexedChars&&(n+="\n if (isString(iterable)) {\n iterable = iterable.split('')\n } "),n+="\n while (++index < length) {\n "+t.loop+";\n }\n}\nelse { "):kn.nonEnumArgs&&(n+="\n var length = iterable.length; index = -1;\n if (length && isArguments(iterable)) {\n while (++index < length) {\n index += '';\n "+t.loop+";\n }\n } else { "),kn.enumPrototypes&&(n+="\n var skipProto = typeof iterable == 'function';\n "),kn.enumErrorProps&&(n+="\n var skipErrorProps = iterable === errorProto || iterable instanceof Error;\n ");var r=[];if(kn.enumPrototypes&&r.push('!(skipProto && index == "prototype")'),kn.enumErrorProps&&r.push('!(skipErrorProps && (index == "message" || index == "name"))'),t.useHas&&t.keys)n+="\n var ownIndex = -1,\n ownProps = objectTypes[typeof iterable] && keys(iterable),\n length = ownProps ? ownProps.length : 0;\n\n while (++ownIndex < length) {\n index = ownProps[ownIndex];\n",r.length&&(n+=" if ("+r.join(" && ")+") {\n "),n+=t.loop+"; ",r.length&&(n+="\n }"),n+="\n } ";else if(n+="\n for (index in iterable) {\n",t.useHas&&r.push("hasOwnProperty.call(iterable, index)"),r.length&&(n+=" if ("+r.join(" && ")+") {\n "),n+=t.loop+"; ",r.length&&(n+="\n }"),n+="\n } ",kn.nonEnumShadows){for(n+="\n\n if (iterable !== objectProto) {\n var ctor = iterable.constructor,\n isProto = iterable === (ctor && ctor.prototype),\n className = iterable === stringProto ? stringClass : iterable === errorProto ? errorClass : toString.call(iterable),\n nonEnum = nonEnumProps[className];\n ",k=0;7>k;k++)n+="\n index = '"+t.shadowedProps[k]+"';\n if ((!(isProto && nonEnum[index]) && hasOwnProperty.call(iterable, index))",t.useHas||(n+=" || (!nonEnum[index] && iterable[index] !== objectProto[index])"),n+=") {\n "+t.loop+";\n } ";n+="\n } "}return(t.array||kn.nonEnumArgs)&&(n+="\n}"),n+=t.bottom+";\nreturn result"};$n||(l=function(){function t(){}return function(n){if(j(n)){t.prototype=n;var r=new t;t.prototype=null}return r||on.Object()}}());var An=xn?function(t,n){nn.value=n,xn(t,"__bindData__",nn)}:N;kn.argsClass||(v=function(t){return t&&"object"==typeof t&&"number"==typeof t.length&&dn.call(t,"callee")&&!vn.call(t,"callee")||!1});var On=jn||function(t){return t&&"object"==typeof t&&"number"==typeof t.length&&hn.call(t)==W||!1},_n=d({args:"object",init:"[]",top:"if (!(objectTypes[typeof object])) return result",loop:"result.push(index)"}),Sn=wn?function(t){return j(t)?kn.enumPrototypes&&"function"==typeof t||kn.nonEnumArgs&&t.length&&v(t)?_n(t):wn(t):[]}:_n,Tn={args:"collection, callback, thisArg",top:"callback = callback && typeof thisArg == 'undefined' ? callback : baseCreateCallback(callback, thisArg, 3)",array:"typeof length == 'number'",keys:Sn,loop:"if (callback(iterable[index], index, collection) === false) return result"},Cn={args:"object, source, guard",top:"var args = arguments,\n argsIndex = 0,\n argsLength = typeof guard == 'number' ? 2 : args.length;\nwhile (++argsIndex < argsLength) {\n iterable = args[argsIndex];\n if (iterable && objectTypes[typeof iterable]) {",keys:Sn,loop:"if (typeof result[index] == 'undefined') result[index] = iterable[index]",bottom:" }\n}"},Ln={top:"if (!objectTypes[typeof iterable]) return result;\n"+Tn.top,array:!1},In=d(Tn),Fn=d(Cn,{top:Cn.top.replace(";",";\nif (argsLength > 3 && typeof args[argsLength - 2] == 'function') {\n var callback = baseCreateCallback(args[--argsLength - 1], args[argsLength--], 2);\n} else if (argsLength > 2 && typeof args[argsLength - 1] == 'function') {\n callback = args[--argsLength];\n}"),loop:"result[index] = callback ? callback(result[index], iterable[index]) : iterable[index]"}),Rn=d(Cn),Nn=d(Tn,Ln,{useHas:!1}),Dn=d(Tn,Ln);$(/x/)&&($=function(t){return"function"==typeof t&&hn.call(t)==U}),a.assign=Fn,a.bind=L,a.constant=I,a.createCallback=F,a.defaults=Rn,a.filter=A,a.forEach=O,a.forIn=Nn,a.forOwn=Dn,a.functions=m,a.keys=Sn,a.map=_,a.pick=E,a.property=D,a.toArray=T,a.values=P,a.zipObject=C,a.collect=_,a.each=O,a.extend=Fn,a.methods=m,a.object=C,a.select=A,a.identity=R,a.isArguments=v,a.isArray=On,a.isEmpty=x,a.isFunction=$,a.isObject=j,a.isString=w,a.noop=N,a.reduce=S,a.foldl=S,a.inject=S,a.VERSION="2.4.1",on._=a,e=function(){return a}.call(n,r,n,t),!(void 0!==e&&(t.exports=e))}).call(this)}).call(n,r(41)(t),function(){return this}())},function(t,n,r){"use strict";var e=r(3),o=r(2),i=r(25),u=r(26);t.exports=function(t){return function(n,r,s){s=e.pick(s,"concurrency");var a=s.concurrency?new i(s):{add:function(t){return t()}},c=e.map(n,function(e,i){return o.when(e)[t](function(t){return a.add(function(){return o.when(r.call(null,t,i,n.length))})})}),l=o.all(c);return u(l,"$$unsynced",c),l}}},function(t,n,r){"use strict";var e=r(24),o=r(1);t.exports=function(t){return t in o.$delegate?function(){return e(o.$delegate[t].apply(o.$delegate,arguments))}:null}},function(t,n,r){"use strict";function e(t,n){o.each(o.methods(t),function(n){s(this,"$$"+n,t[n])},this),n&&n.$$boundTo&&s(this,"$$boundTo",n.$$boundTo),s(this,"$$arrayListeners",[]),this.then=t.then=this.then.bind(this)}var o=r(3),i=r(1),u=r(27),s=r(26),a={"catch":"caught","finally":"lastly","return":["thenReturn","returns"],"throw":["thenThrow"]};t.exports=function(t,n){return new e(t,n)},e.prototype={all:u("all"),any:u("any"),bind:r(28),call:r(29),"catch":r(30),delay:r(31),done:r(32),each:u("each"),filter:u("filter"),"finally":function(){return this.$$finally.apply(this,arguments)},get:r(33),map:u("map"),nodeify:r(34),props:u("props"),reduce:u("reduce"),"return":r(35),some:u("some"),spread:r(36),tap:r(37),then:r(38),"throw":r(39),timeout:r(40),constructor:e},s(e.prototype,"$$callArrayListeners",function(t){o.each(this.$$arrayListeners,function(n){n(t)})}),o.each(a,function(t,n){o.isArray(t)||(t=[t]),i.$options.compatibilityAliases&&o.each(t,function(t){e.prototype[t]=e.prototype[n]}),i.$options.disableES5Methods&&delete e.prototype[n]})},function(t,n,r){"use strict";var e=r(3),o=r(1),i=t.exports=function(t){this.$options=e.defaults(t,{concurrency:1,maxQueue:0}),this.$fns=[]};i.prototype.add=function(t){var n=o.$defer(),r=function(){t()["finally"](function(){this.$fns.splice(this.$fns.indexOf(r),1),this.$fns.length>=this.$options.concurrency&&this.$fns[this.$options.concurrency-1]()}.bind(this)).then(function(t){n.resolve(t)},function(t){n.reject(t)})}.bind(this);return this.$fns.push(r)<=this.$options.concurrency&&r(),n.promise}},function(t){"use strict";t.exports=function(t,n,r){if(Object.defineProperty)try{Object.defineProperty(t,n,{value:r})}catch(e){}t[n]!==r&&(t[n]=r)}},function(t,n,r){"use strict";var e=r(42),o=r(2),i=r(26);t.exports=function(t){function n(n,r){var e=o[t].apply(null,[r].concat(n));return i(e,"$$boundTo",this.$$boundTo),e}return function(){var t=e.call(this,arguments);if(this.$$unsynced)return n.call(this,t,this.$$unsynced);var r=this.then(function(e){if(r.$$promiseResult)return r.$$promiseResult;var o=n.call(this,t,e);return r.$$arrayListeners.length&&o.$$unsynced&&r.$$callArrayListeners(o.$$unsynced),o}.bind(this));return this.$$arrayListeners.push(function(e){i(this,"$$promiseResult",n.call(this,t,e)),r.$$arrayListeners.length&&this.$$promiseResult.$$unsynced&&r.$$callArrayListeners(this.$$promiseResult.$$unsynced)}.bind(this)),r}}},function(t,n,r){"use strict";var e=r(26);t.exports=function(t){return e(this,"$$boundTo",t),this}},function(t,n,r){"use strict";var e=r(3);t.exports=function(){var t=e.toArray(arguments),n=t.shift();return this.then(function(r){return r[n].apply(r,t)})}},function(t,n,r){"use strict";function e(t,n){var r=!t.length;return i.each(t,function(t){if(!i.isFunction(t))throw new Error("Invalid argument.");return t instanceof Error||t.prototype instanceof Error?(r=r||n instanceof t,!r):(r=r||t(n),!r)}),r}var o=r(2),i=r(3);t.exports=function(){var t=i.toArray(arguments),n=t.pop();return this.$$catch(function(r){return i.isFunction(n)&&e(t,r)?n.call(this,r):o.reject(r)})}},function(t,n,r){"use strict";var e=r(1);t.exports=function(t){return this.then(function(n){var r=e.$defer(this);return setTimeout(r.resolve,t,n),r.promise}.bind(this))}},function(t,n,r){"use strict";var e=r(2);t.exports=function(){return this.then.apply(this,arguments).$$catch(function(t){setTimeout(function(){throw t})}).$$finally(function(){return e.reject(new Error("Do not chain anything after calling done()!"))})}},function(t){"use strict";t.exports=function(t){return this.then(function(n){return n[t]})}},function(t,n,r){"use strict";var e=r(3),o=r(2);t.exports=function(t,n){return t=t||e.noop,n=n||{},this.then(function(r){var o=r;return o=n.spread&&e.isArray(o)?[null].concat(o):[null,o],t.apply(this,o),r},function(n){return t.call(this,n),o.reject(n)})}},function(t,n,r){"use strict";var e=r(3);t.exports=function(t){return this.then(e.constant(t))}},function(t,n,r){"use strict";var e=r(3);t.exports=function(t){return this.then(function(n){return e.isArray(n)||(n=[n]),t.apply(this,n)})}},function(t,n,r){"use strict";var e=r(2);t.exports=function(t){return this.then(function(n){return e.when(t.call(this,n)).returns(n)})}},function(t,n,r){"use strict";var e=r(42),o=r(24);t.exports=function(){return o(this.$$then.apply(null,e.call(this,arguments)),this)}},function(t,n,r){"use strict";var e=r(2);t.exports=function(t){return this.then(function(){return e.reject(t)})}},function(t,n,r){"use strict";var e=r(1),o=r(2);t.exports=function(t,n){var r=e.$defer(this),i=setTimeout(function(){r.reject(new o.TimeoutError(n||"Timed out after "+t+" ms"))},t);return this.then(function(t){r.resolve(t)},function(t){r.reject(t)})["finally"](clearTimeout.bind(null,i)),r.promise}},function(t){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children=[],t.webpackPolyfill=1),t}},function(t,n,r){"use strict";var e=r(3);t.exports=function(t){return e.map(t,function(t){return e.isFunction(t)?t.bind(this.$$boundTo||this):t},this)}}])}); | ||
!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):"object"==typeof exports?exports["angular-extend-promises"]=n():t["angular-extend-promises"]=n()}(this,function(){return function(t){function n(e){if(r[e])return r[e].exports;var o=r[e]={exports:{},id:e,loaded:!1};return t[e].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}var r={};return n.m=t,n.c=r,n.p="",n(0)}([function(t,n,r){"use strict";angular.module("angular-extend-promises",[]).provider("angularExtendPromises",function(){this.options={compatibilityAliases:!0,disableES5Methods:!1},this.$get=function(){return this.options}}).config(["$provide",function(t){if(angular.mock)for(var n in r.c)delete r.c[n];t.decorator("$q",["$delegate","angularExtendPromises",function(t,n){var e=r(1);return e.$delegate=t,e.$options=n,r(2)}])}])},function(t,n,r){"use strict";var e=r(3);e.extend(t.exports,{$defer:e.noop(),$delegate:{},$options:{}})},function(t,n,r){"use strict";var e=r(3),o=r(1),i=r(4);t.exports=function(n){var r=t.exports.defer();try{n(r.resolve,r.reject)}catch(e){r.reject(e)}return r},e.extend(t.exports,{all:r(5),any:r(6),bind:r(7),defer:r(8),each:r(9),filter:r(10),map:r(11),join:r(12),method:r(13),props:r(14),reduce:r(15),reject:r(16),resolve:r(17),some:r(18),when:r(19),AggregateError:i.AggregateError,TimeoutError:i.TimeoutError}),o.$options.compatibilityAliases&&e.extend(t.exports,{attempt:r(20)}),o.$options.disableES5Methods||e.extend(t.exports,{"try":r(20)})},function(t,n,r){"use strict";try{t.exports=r(21)}catch(e){t.exports=_}},function(t){"use strict";var n=t.exports.NewQError=function(t){this.name=this.constructor.name,Error.apply(this,arguments),this.message=t,Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack};n.prototype.toString=function(){return this.stack.toString()},n.subError=function(t,r){function e(){}r=r||n,e.prototype=r.prototype,t.prototype=new e,t.prototype.constructor=t,t.subError||(t.subError=function(r){n.subError(r,t)})},n.subError(n,Error);var r=t.exports.AggregateError=function(){n.apply(this,arguments)};n.subError(r);var e=t.exports.TimeoutError=function(){n.apply(this,arguments)};n.subError(e)},function(t,n,r){"use strict";var e=r(3),o=r(24),i=r(1),u=r(2);t.exports=function(t){return e.isArray(t)?(t=e.map(t,function(t){return u.when(t)}),o(i.$delegate.all(t))):u.props(t)}},function(t,n,r){"use strict";var e=r(2);t.exports=function(t){return e.some(t,1).get(0)}},function(t,n,r){"use strict";var e=r(2);t.exports=function(t){return e.resolve().bind(t)}},function(t,n,r){"use strict";var e=r(24),o=r(1);o.$defer=function(t){var n=o.$delegate.defer();return n.promise=e(n.promise,t),n},t.exports=function(){return o.$defer()}},function(t,n,r){"use strict";var e=r(22);t.exports=e("tap")},function(t,n,r){"use strict";var e=r(3),o=r(2);t.exports=function(t,n,r){return o.map(t,function(t){return o.props({val:t,toFilter:n.apply(null,arguments)})},r).then(function(t){return e.map(e.filter(t,"toFilter"),"val")})}},function(t,n,r){"use strict";var e=r(22);t.exports=e("then")},function(t,n,r){"use strict";var e=r(3),o=r(2);t.exports=function(){var t=e.toArray(arguments),n=t.pop();return o.all(t).spread(n)}},function(t,n,r){"use strict";var e=r(20);t.exports=function(t){return function(){return e(t,arguments,this)}}},function(t,n,r){"use strict";var e=r(3),o=r(2);t.exports=function(t){return o.all(e.values(t)).then(function(n){return e.object(e.keys(t),n)})}},function(t,n,r){"use strict";var e=r(3),o=r(2);t.exports=function(t,n,r){return e.reduce(t,function(r,e,i){return o.join(r,e,function(r,e){return n(r,e,i,t.length)})},o.resolve(r))}},function(t,n,r){"use strict";var e=r(23);t.exports=e("reject")},function(t,n,r){"use strict";var e=r(2),o=r(23);t.exports=o("resolve")||function(t){var n=e.defer();return n.resolve(t),n.promise}},function(t,n,r){"use strict";var e=r(3),o=r(2),i=r(4).AggregateError;t.exports=function(t,n){if(t.length<n)return o.reject(new i("initial array length ("+t.length+") > count ("+n+")"));var r=0,u=[],s=o.defer();return e.each(t,function(e){o.when(e).tap(function(t){null!==u&&(u.push(t),u.length>=n&&(s.resolve(u),u=null))}).$$catch(function(){null!==u&&(++r,t.length-r<n&&(s.reject(new i("Cannot resolve promise: too many rejections ("+r+")")),u=null))})}),s.promise}},function(t,n,r){"use strict";var e=r(23);t.exports=e("when")},function(t,n,r){"use strict";var e=r(3),o=r(2);t.exports=function(t,n,r){try{return e.isEmpty(n)||e.isArray(n)||(n=[n]),o.when(t.apply(r||this,n))}catch(i){return o.reject(i)}}},function(t,n,r){var e;(function(t,o){(function(){function i(){return H.pop()||[]}function u(t){t.length=0,H.length<Q&&H.push(t)}function s(t,n,r){n||(n=0),"undefined"==typeof r&&(r=t?t.length:0);for(var e=-1,o=r-n||0,i=Array(0>o?0:o);++e<o;)i[e]=t[n+e];return i}function a(){}function c(t){function n(){if(e){var t=s(e);bn.apply(t,arguments)}if(this instanceof n){var i=l(r.prototype),u=r.apply(i,t||arguments);return j(u)?u:i}return r.apply(o,t||arguments)}var r=t[0],e=t[2],o=t[4];return An(n,t),n}function l(t){return j(t)?$n(t):{}}function f(t,n,r){if("function"!=typeof t)return R;if("undefined"==typeof n||!("prototype"in t))return t;var e=t.__bindData__;if("undefined"==typeof e&&(kn.funcNames&&(e=!t.name),e=e||!kn.funcDecomp,!e)){var o=yn.call(t);kn.funcNames||(e=!q.test(o)),e||(e=z.test(o),An(t,e))}if(e===!1||e!==!0&&1&e[1])return t;switch(r){case 1:return function(r){return t.call(n,r)};case 2:return function(r,e){return t.call(n,r,e)};case 3:return function(r,e,o){return t.call(n,r,e,o)};case 4:return function(r,e,o,i){return t.call(n,r,e,o,i)}}return L(t,n)}function p(t){function n(){var t=c?u:this;if(o){var d=s(o);bn.apply(d,arguments)}if((i||h)&&(d||(d=s(arguments)),i&&bn.apply(d,i),h&&d.length<a))return e|=16,p([r,g?e:-4&e,d,null,u,a]);if(d||(d=arguments),f&&(r=t[y]),this instanceof n){t=l(r.prototype);var b=r.apply(t,d);return j(b)?b:t}return r.apply(t,d)}var r=t[0],e=t[1],o=t[2],i=t[3],u=t[4],a=t[5],c=1&e,f=2&e,h=4&e,g=8&e,y=r;return An(n,t),n}function h(t,n,r,e){for(var o=(e||0)-1,i=t?t.length:0,u=[];++o<i;){var s=t[o];if(s&&"object"==typeof s&&"number"==typeof s.length&&(On(s)||v(s))){n||(s=h(s,n,r));var a=-1,c=s.length,l=u.length;for(u.length+=c;++a<c;)u[l++]=s[a]}else r||u.push(s)}return u}function g(t,n,r,e,o,s){if(r){var a=r(t,n);if("undefined"!=typeof a)return!!a}if(t===n)return 0!==t||1/t==1/n;var c=typeof t,l=typeof n;if(!(t!==t||t&&en[c]||n&&en[l]))return!1;if(null==t||null==n)return t===n;var f=hn.call(t),p=hn.call(n);if(f==V&&(f=Y),p==V&&(p=Y),f!=p)return!1;switch(f){case G:case J:return+t==+n;case X:return t!=+t?n!=+n:0==t?1/t==1/n:t==+n;case Z:case tn:return t==String(n)}var h=f==W;if(!h){var y=dn.call(t,"__wrapped__"),d=dn.call(n,"__wrapped__");if(y||d)return g(y?t.__wrapped__:t,d?n.__wrapped__:n,r,e,o,s);if(f!=Y)return!1;var b=!kn.argsObject&&v(t)?Object:t.constructor,m=!kn.argsObject&&v(n)?Object:n.constructor;if(b!=m&&!($(b)&&b instanceof b&&$(m)&&m instanceof m)&&"constructor"in t&&"constructor"in n)return!1}var x=!o;o||(o=i()),s||(s=i());for(var j=o.length;j--;)if(o[j]==t)return s[j]==n;var w=0;if(a=!0,o.push(t),s.push(n),h){if(j=t.length,w=n.length,a=w==j,a||e)for(;w--;){var E=j,k=n[w];if(e)for(;E--&&!(a=g(t[E],k,r,e,o,s)););else if(!(a=g(t[w],k,r,e,o,s)))break}}else Nn(n,function(n,i,u){return dn.call(u,i)?(w++,a=dn.call(t,i)&&g(t[i],n,r,e,o,s)):void 0}),a&&!e&&Nn(t,function(t,n,r){return dn.call(r,n)?a=--w>-1:void 0});return o.pop(),s.pop(),x&&(u(o),u(s)),a}function y(t,n,r,e,o,i){var u=1&n,a=2&n,l=4&n,f=16&n,h=32&n;if(!a&&!$(t))throw new TypeError;f&&!r.length&&(n&=-17,f=r=!1),h&&!e.length&&(n&=-33,h=e=!1);var g=t&&t.__bindData__;if(g&&g!==!0)return g=s(g),g[2]&&(g[2]=s(g[2])),g[3]&&(g[3]=s(g[3])),!u||1&g[1]||(g[4]=o),!u&&1&g[1]&&(n|=8),!l||4&g[1]||(g[5]=i),f&&bn.apply(g[2]||(g[2]=[]),r),h&&mn.apply(g[3]||(g[3]=[]),e),g[1]|=n,y.apply(null,g);var d=1==n||17===n?c:p;return d([t,n,r,e,o,i])}function d(){rn.shadowedProps=B,rn.array=rn.bottom=rn.loop=rn.top="",rn.init="iterable",rn.useHas=!0;for(var t,n=0;t=arguments[n];n++)for(var r in t)rn[r]=t[r];var e=rn.args;rn.firstArg=/^[^,]+/.exec(e)[0];var o=Function("baseCreateCallback, errorClass, errorProto, hasOwnProperty, indicatorObject, isArguments, isArray, isString, keys, objectProto, objectTypes, nonEnumProps, stringClass, stringProto, toString","return function("+e+") {\n"+Pn(rn)+"\n}");return o(f,K,ln,dn,M,v,On,w,rn.keys,fn,en,En,tn,pn,hn)}function b(t){return"function"==typeof t&&gn.test(t)}function v(t){return t&&"object"==typeof t&&"number"==typeof t.length&&hn.call(t)==V||!1}function m(t){var n=[];return Nn(t,function(t,r){$(t)&&n.push(r)}),n.sort()}function x(t){var n=!0;if(!t)return n;var r=hn.call(t),e=t.length;return r==W||r==tn||(kn.argsClass?r==V:v(t))||r==Y&&"number"==typeof e&&$(t.splice)?!e:(Dn(t,function(){return n=!1}),n)}function $(t){return"function"==typeof t}function j(t){return!(!t||!en[typeof t])}function w(t){return"string"==typeof t||t&&"object"==typeof t&&hn.call(t)==tn||!1}function E(t,n,r){var e={};if("function"!=typeof n)for(var o=-1,i=h(arguments,!0,!1,1),u=j(t)?i.length:0;++o<u;){var s=i[o];s in t&&(e[s]=t[s])}else n=a.createCallback(n,r,3),Nn(t,function(t,r,o){n(t,r,o)&&(e[r]=t)});return e}function P(t){for(var n=-1,r=Sn(t),e=r.length,o=Array(e);++n<e;)o[n]=t[r[n]];return o}function A(t,n,r){var e=[];if(n=a.createCallback(n,r,3),On(t))for(var o=-1,i=t.length;++o<i;){var u=t[o];n(u,o,t)&&e.push(u)}else In(t,function(t,r,o){n(t,r,o)&&e.push(t)});return e}function O(t,n,r){if(n&&"undefined"==typeof r&&On(t))for(var e=-1,o=t.length;++e<o&&n(t[e],e,t)!==!1;);else In(t,n,r);return t}function _(t,n,r){var e=-1,o=t?t.length:0,i=Array("number"==typeof o?o:0);if(n=a.createCallback(n,r,3),On(t))for(;++e<o;)i[e]=n(t[e],e,t);else In(t,function(t,r,o){i[++e]=n(t,r,o)});return i}function S(t,n,r,e){var o=arguments.length<3;if(n=a.createCallback(n,e,4),On(t)){var i=-1,u=t.length;for(o&&(r=t[++i]);++i<u;)r=n(r,t[i],i,t)}else In(t,function(t,e,i){r=o?(o=!1,t):n(r,t,e,i)});return r}function T(t){return t&&"number"==typeof t.length?kn.unindexedChars&&w(t)?t.split(""):s(t):P(t)}function C(t,n){var r=-1,e=t?t.length:0,o={};for(n||!e||On(t[0])||(n=[]);++r<e;){var i=t[r];n?o[i]=n[r]:i&&(o[i[0]]=i[1])}return o}function L(t,n){return arguments.length>2?y(t,17,s(arguments,2),null,n):y(t,1,null,null,n)}function I(t){return function(){return t}}function F(t,n,r){var e=typeof t;if(null==t||"function"==e)return f(t,n,r);if("object"!=e)return D(t);var o=Sn(t),i=o[0],u=t[i];return 1!=o.length||u!==u||j(u)?function(n){for(var r=o.length,e=!1;r--&&(e=g(n[o[r]],t[o[r]],null,!0)););return e}:function(t){var n=t[i];return u===n&&(0!==u||1/u==1/n)}}function R(t){return t}function N(){}function D(t){return function(n){return n[t]}}var H=[],M={},Q=40,q=/^\s*function[ \n\r\t]+\w/,z=/\bthis\b/,B=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],V="[object Arguments]",W="[object Array]",G="[object Boolean]",J="[object Date]",K="[object Error]",U="[object Function]",X="[object Number]",Y="[object Object]",Z="[object RegExp]",tn="[object String]",nn={configurable:!1,enumerable:!1,value:null,writable:!1},rn={args:"",array:null,bottom:"",firstArg:"",init:"",keys:null,loop:"",shadowedProps:null,support:null,top:"",useHas:!1},en={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},on=en[typeof window]&&window||this,un=en[typeof n]&&n&&!n.nodeType&&n,sn=en[typeof t]&&t&&!t.nodeType&&t,an=(sn&&sn.exports===un&&un,en[typeof o]&&o);!an||an.global!==an&&an.window!==an||(on=an);var cn=[],ln=Error.prototype,fn=Object.prototype,pn=String.prototype,hn=fn.toString,gn=RegExp("^"+String(hn).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),yn=Function.prototype.toString,dn=fn.hasOwnProperty,bn=cn.push,vn=fn.propertyIsEnumerable,mn=cn.unshift,xn=function(){try{var t={},n=b(n=Object.defineProperty)&&n,r=n(t,t,t)&&n}catch(e){}return r}(),$n=b($n=Object.create)&&$n,jn=b(jn=Array.isArray)&&jn,wn=b(wn=Object.keys)&&wn,En={};En[W]=En[J]=En[X]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},En[G]=En[tn]={constructor:!0,toString:!0,valueOf:!0},En[K]=En[U]=En[Z]={constructor:!0,toString:!0},En[Y]={constructor:!0},function(){for(var t=B.length;t--;){var n=B[t];for(var r in En)dn.call(En,r)&&!dn.call(En[r],n)&&(En[r][n]=!1)}}();var kn=a.support={};!function(){var t=function(){this.x=1},n={0:1,length:1},r=[];t.prototype={valueOf:1,y:1};for(var e in new t)r.push(e);for(e in arguments);kn.argsClass=hn.call(arguments)==V,kn.argsObject=arguments.constructor==Object&&!(arguments instanceof Array),kn.enumErrorProps=vn.call(ln,"message")||vn.call(ln,"name"),kn.enumPrototypes=vn.call(t,"prototype"),kn.funcDecomp=!b(on.WinRTError)&&z.test(function(){return this}),kn.funcNames="string"==typeof Function.name,kn.nonEnumArgs=0!=e,kn.nonEnumShadows=!/valueOf/.test(r),kn.spliceObjects=(cn.splice.call(n,0,1),!n[0]),kn.unindexedChars="x"[0]+Object("x")[0]!="xx"}(1);var Pn=function(t){var n="var index, iterable = "+t.firstArg+", result = "+t.init+";\nif (!iterable) return result;\n"+t.top+";";t.array?(n+="\nvar length = iterable.length; index = -1;\nif ("+t.array+") { ",kn.unindexedChars&&(n+="\n if (isString(iterable)) {\n iterable = iterable.split('')\n } "),n+="\n while (++index < length) {\n "+t.loop+";\n }\n}\nelse { "):kn.nonEnumArgs&&(n+="\n var length = iterable.length; index = -1;\n if (length && isArguments(iterable)) {\n while (++index < length) {\n index += '';\n "+t.loop+";\n }\n } else { "),kn.enumPrototypes&&(n+="\n var skipProto = typeof iterable == 'function';\n "),kn.enumErrorProps&&(n+="\n var skipErrorProps = iterable === errorProto || iterable instanceof Error;\n ");var r=[];if(kn.enumPrototypes&&r.push('!(skipProto && index == "prototype")'),kn.enumErrorProps&&r.push('!(skipErrorProps && (index == "message" || index == "name"))'),t.useHas&&t.keys)n+="\n var ownIndex = -1,\n ownProps = objectTypes[typeof iterable] && keys(iterable),\n length = ownProps ? ownProps.length : 0;\n\n while (++ownIndex < length) {\n index = ownProps[ownIndex];\n",r.length&&(n+=" if ("+r.join(" && ")+") {\n "),n+=t.loop+"; ",r.length&&(n+="\n }"),n+="\n } ";else if(n+="\n for (index in iterable) {\n",t.useHas&&r.push("hasOwnProperty.call(iterable, index)"),r.length&&(n+=" if ("+r.join(" && ")+") {\n "),n+=t.loop+"; ",r.length&&(n+="\n }"),n+="\n } ",kn.nonEnumShadows){for(n+="\n\n if (iterable !== objectProto) {\n var ctor = iterable.constructor,\n isProto = iterable === (ctor && ctor.prototype),\n className = iterable === stringProto ? stringClass : iterable === errorProto ? errorClass : toString.call(iterable),\n nonEnum = nonEnumProps[className];\n ",k=0;7>k;k++)n+="\n index = '"+t.shadowedProps[k]+"';\n if ((!(isProto && nonEnum[index]) && hasOwnProperty.call(iterable, index))",t.useHas||(n+=" || (!nonEnum[index] && iterable[index] !== objectProto[index])"),n+=") {\n "+t.loop+";\n } ";n+="\n } "}return(t.array||kn.nonEnumArgs)&&(n+="\n}"),n+=t.bottom+";\nreturn result"};$n||(l=function(){function t(){}return function(n){if(j(n)){t.prototype=n;var r=new t;t.prototype=null}return r||on.Object()}}());var An=xn?function(t,n){nn.value=n,xn(t,"__bindData__",nn)}:N;kn.argsClass||(v=function(t){return t&&"object"==typeof t&&"number"==typeof t.length&&dn.call(t,"callee")&&!vn.call(t,"callee")||!1});var On=jn||function(t){return t&&"object"==typeof t&&"number"==typeof t.length&&hn.call(t)==W||!1},_n=d({args:"object",init:"[]",top:"if (!(objectTypes[typeof object])) return result",loop:"result.push(index)"}),Sn=wn?function(t){return j(t)?kn.enumPrototypes&&"function"==typeof t||kn.nonEnumArgs&&t.length&&v(t)?_n(t):wn(t):[]}:_n,Tn={args:"collection, callback, thisArg",top:"callback = callback && typeof thisArg == 'undefined' ? callback : baseCreateCallback(callback, thisArg, 3)",array:"typeof length == 'number'",keys:Sn,loop:"if (callback(iterable[index], index, collection) === false) return result"},Cn={args:"object, source, guard",top:"var args = arguments,\n argsIndex = 0,\n argsLength = typeof guard == 'number' ? 2 : args.length;\nwhile (++argsIndex < argsLength) {\n iterable = args[argsIndex];\n if (iterable && objectTypes[typeof iterable]) {",keys:Sn,loop:"if (typeof result[index] == 'undefined') result[index] = iterable[index]",bottom:" }\n}"},Ln={top:"if (!objectTypes[typeof iterable]) return result;\n"+Tn.top,array:!1},In=d(Tn),Fn=d(Cn,{top:Cn.top.replace(";",";\nif (argsLength > 3 && typeof args[argsLength - 2] == 'function') {\n var callback = baseCreateCallback(args[--argsLength - 1], args[argsLength--], 2);\n} else if (argsLength > 2 && typeof args[argsLength - 1] == 'function') {\n callback = args[--argsLength];\n}"),loop:"result[index] = callback ? callback(result[index], iterable[index]) : iterable[index]"}),Rn=d(Cn),Nn=d(Tn,Ln,{useHas:!1}),Dn=d(Tn,Ln);$(/x/)&&($=function(t){return"function"==typeof t&&hn.call(t)==U}),a.assign=Fn,a.bind=L,a.constant=I,a.createCallback=F,a.defaults=Rn,a.filter=A,a.forEach=O,a.forIn=Nn,a.forOwn=Dn,a.functions=m,a.keys=Sn,a.map=_,a.pick=E,a.property=D,a.toArray=T,a.values=P,a.zipObject=C,a.collect=_,a.each=O,a.extend=Fn,a.methods=m,a.object=C,a.select=A,a.identity=R,a.isArguments=v,a.isArray=On,a.isEmpty=x,a.isFunction=$,a.isObject=j,a.isString=w,a.noop=N,a.reduce=S,a.foldl=S,a.inject=S,a.VERSION="2.4.1",on._=a,e=function(){return a}.call(n,r,n,t),!(void 0!==e&&(t.exports=e))}).call(this)}).call(n,r(41)(t),function(){return this}())},function(t,n,r){"use strict";var e=r(3),o=r(2),i=r(25),u=r(26);t.exports=function(t){return function(n,r,s){s=e.pick(s,"concurrency");var a=s.concurrency?new i(s):{add:function(t){return t()}},c=e.map(n,function(e,i){return o.when(e)[t](function(t){return a.add(function(){return o.when(r.call(null,t,i,n.length))})})}),l=o.all(c);return u(l,"$$unsynced",c),l}}},function(t,n,r){"use strict";var e=r(24),o=r(1);t.exports=function(t){return t in o.$delegate?function(){return e(o.$delegate[t].apply(o.$delegate,arguments))}:null}},function(t,n,r){"use strict";function e(t,n){s(this,"$$state",t.$$state),o.each(o.methods(t),function(n){s(this,"$$"+n,t[n])},this),n&&n.$$boundTo&&s(this,"$$boundTo",n.$$boundTo),s(this,"$$arrayListeners",[]),this.then=t.then=this.then.bind(this)}var o=r(3),i=r(1),u=r(27),s=r(26),a={"catch":"caught","finally":"lastly","return":["thenReturn","returns"],"throw":["thenThrow"]};t.exports=function(t,n){return new e(t,n)},e.prototype={all:u("all"),any:u("any"),bind:r(28),call:r(29),"catch":r(30),delay:r(31),done:r(32),each:u("each"),filter:u("filter"),"finally":function(){return this.$$finally.apply(this,arguments)},get:r(33),map:u("map"),nodeify:r(34),props:u("props"),reduce:u("reduce"),"return":r(35),some:u("some"),spread:r(36),tap:r(37),then:r(38),"throw":r(39),timeout:r(40),constructor:e},s(e.prototype,"$$callArrayListeners",function(t){o.each(this.$$arrayListeners,function(n){n(t)})}),o.each(a,function(t,n){o.isArray(t)||(t=[t]),i.$options.compatibilityAliases&&o.each(t,function(t){e.prototype[t]=e.prototype[n]}),i.$options.disableES5Methods&&delete e.prototype[n]})},function(t,n,r){"use strict";var e=r(3),o=r(1),i=t.exports=function(t){this.$options=e.defaults(t,{concurrency:1,maxQueue:0}),this.$fns=[]};i.prototype.add=function(t){var n=o.$defer(),r=function(){t()["finally"](function(){this.$fns.splice(this.$fns.indexOf(r),1),this.$fns.length>=this.$options.concurrency&&this.$fns[this.$options.concurrency-1]()}.bind(this)).then(function(t){n.resolve(t)},function(t){n.reject(t)})}.bind(this);return this.$fns.push(r)<=this.$options.concurrency&&r(),n.promise}},function(t){"use strict";t.exports=function(t,n,r){if(Object.defineProperty)try{Object.defineProperty(t,n,{value:r})}catch(e){}t[n]!==r&&(t[n]=r)}},function(t,n,r){"use strict";var e=r(42),o=r(2),i=r(26);t.exports=function(t){function n(n,r){var e=o[t].apply(null,[r].concat(n));return i(e,"$$boundTo",this.$$boundTo),e}return function(){var t=e.call(this,arguments);if(this.$$unsynced)return n.call(this,t,this.$$unsynced);var r=this.then(function(e){if(r.$$promiseResult)return r.$$promiseResult;var o=n.call(this,t,e);return r.$$arrayListeners.length&&o.$$unsynced&&r.$$callArrayListeners(o.$$unsynced),o}.bind(this));return this.$$arrayListeners.push(function(e){i(this,"$$promiseResult",n.call(this,t,e)),r.$$arrayListeners.length&&this.$$promiseResult.$$unsynced&&r.$$callArrayListeners(this.$$promiseResult.$$unsynced)}.bind(this)),r}}},function(t,n,r){"use strict";var e=r(26);t.exports=function(t){return e(this,"$$boundTo",t),this}},function(t,n,r){"use strict";var e=r(3);t.exports=function(){var t=e.toArray(arguments),n=t.shift();return this.then(function(r){return r[n].apply(r,t)})}},function(t,n,r){"use strict";function e(t,n){var r=!t.length;return i.each(t,function(t){if(!i.isFunction(t))throw new Error("Invalid argument.");return t instanceof Error||t.prototype instanceof Error?(r=r||n instanceof t,!r):(r=r||t(n),!r)}),r}var o=r(2),i=r(3);t.exports=function(){var t=i.toArray(arguments),n=t.pop();return this.$$catch(function(r){return i.isFunction(n)&&e(t,r)?n.call(this,r):o.reject(r)})}},function(t,n,r){"use strict";var e=r(1);t.exports=function(t){return this.then(function(n){var r=e.$defer(this);return setTimeout(r.resolve,t,n),r.promise}.bind(this))}},function(t,n,r){"use strict";var e=r(2);t.exports=function(){return this.then.apply(this,arguments).$$catch(function(t){setTimeout(function(){throw t})}).$$finally(function(){return e.reject(new Error("Do not chain anything after calling done()!"))})}},function(t){"use strict";t.exports=function(t){return this.then(function(n){return n[t]})}},function(t,n,r){"use strict";var e=r(3),o=r(2);t.exports=function(t,n){return t=t||e.noop,n=n||{},this.then(function(r){var o=r;return o=n.spread&&e.isArray(o)?[null].concat(o):[null,o],t.apply(this,o),r},function(n){return t.call(this,n),o.reject(n)})}},function(t,n,r){"use strict";var e=r(3);t.exports=function(t){return this.then(e.constant(t))}},function(t,n,r){"use strict";var e=r(3);t.exports=function(t){return this.then(function(n){return e.isArray(n)||(n=[n]),t.apply(this,n)})}},function(t,n,r){"use strict";var e=r(2);t.exports=function(t){return this.then(function(n){return e.when(t.call(this,n)).returns(n)})}},function(t,n,r){"use strict";var e=r(42),o=r(24);t.exports=function(){return o(this.$$then.apply(this,e.call(this,arguments)),this)}},function(t,n,r){"use strict";var e=r(2);t.exports=function(t){return this.then(function(){return e.reject(t)})}},function(t,n,r){"use strict";var e=r(1),o=r(2);t.exports=function(t,n){var r=e.$defer(this),i=setTimeout(function(){r.reject(new o.TimeoutError(n||"Timed out after "+t+" ms"))},t);return this.then(function(t){r.resolve(t)},function(t){r.reject(t)})["finally"](clearTimeout.bind(null,i)),r.promise}},function(t){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children=[],t.webpackPolyfill=1),t}},function(t,n,r){"use strict";var e=r(3);t.exports=function(t){return e.map(t,function(t){return e.isFunction(t)?t.bind(this.$$boundTo||this):t},this)}}])}); | ||
//# sourceMappingURL=angular-extend-promises.min.js.map |
{ | ||
"name": "angular-extend-promises", | ||
"version": "1.0.0-beta.9", | ||
"version": "1.0.0-beta.10", | ||
"homepage": "https://bitbucket.org/lsystems/angular-extend-promises", | ||
@@ -43,19 +43,19 @@ "author": "L.systems SARL", | ||
"grunt": "^0.4.5", | ||
"grunt-bumpup": "^0.6.0", | ||
"grunt-bumpup": "^0.6.2", | ||
"grunt-contrib-clean": "^0.6.0", | ||
"grunt-contrib-jshint": "^0.10.0", | ||
"grunt-jscs": "^0.6.2", | ||
"grunt-karma": "^0.8.3", | ||
"grunt-jscs": "^0.8.1", | ||
"grunt-karma": "^0.9.0", | ||
"grunt-mocha-protractor": "^0.5.2", | ||
"grunt-webpack": "^1.0.7", | ||
"jshint-stylish": "^0.4.0", | ||
"karma": "^0.12.19", | ||
"karma-chai-plugins": "^0.2.1", | ||
"karma-chrome-launcher": "^0.1.4", | ||
"jshint-stylish": "^1.0.0", | ||
"karma": "^0.12.25", | ||
"karma-chai-plugins": "^0.2.3", | ||
"karma-chrome-launcher": "^0.1.5", | ||
"karma-firefox-launcher": "^0.1.3", | ||
"karma-mocha": "^0.1.6", | ||
"karma-mocha": "^0.1.9", | ||
"karma-phantomjs-launcher": "^0.1.4", | ||
"lodash-cli": "^2.4.2", | ||
"mocha": "^1.21.3", | ||
"semver": "^3.0.1", | ||
"mocha": "^2.0.1", | ||
"semver": "^4.1.0", | ||
"shelljs": "^0.3.0", | ||
@@ -70,2 +70,2 @@ "uglifyify": "^2.5.0", | ||
} | ||
} | ||
} |
153
README.md
@@ -81,3 +81,3 @@ Angular-extend-promises | ||
- [```.reduce(Function reducer [, dynamic initialValue])```](#markdown-header-reducefunction-reducer-dynamic-initialvalue) | ||
- [```.settle()```](#markdown-header-settle) | ||
- [```.settle()```](#markdown-header-settle) **not implemented yet** | ||
- [```.some(int count)```](#markdown-header-someint-count) | ||
@@ -115,7 +115,3 @@ | ||
Error classes available: | ||
- [```AggregateError()```](#markdown-header-aggregateerror) | ||
## Aliases | ||
@@ -323,2 +319,15 @@ | ||
}) | ||
.catch(MyCustomError1, MyCustomError2, function(e) { | ||
// Will end up here if one of the 2 defined above | ||
}) | ||
.catch(function predicate(e) { | ||
return e.code >= 400 | ||
}, function(e) { | ||
// Will end up here if e.code >= 400 | ||
}) | ||
.catch(MyCustomError3, function predicate(e) { | ||
return e.code < 300; | ||
}, function(e) { | ||
// You can mix predicates & error constructor to filter errors | ||
}) | ||
.catch(function(e) { | ||
@@ -330,3 +339,6 @@ // Generic catch-the rest, error wasn't TypeError nor ReferenceError | ||
Alias: Promise.caught | ||
More documentation on [Angular's project](https://docs.angularjs.org/api/ng/service/$q#the-promise-api) | ||
and on [Bluebird's project](https://github.com/petkaantonov/bluebird/blob/master/API.md#catchfunction-errorclassfunction-predicate-function-handler---promise) | ||
@@ -351,2 +363,4 @@ | ||
Alias: Promise.lastly | ||
More documentation on [Angular's project](https://docs.angularjs.org/api/ng/service/$q#the-promise-api) | ||
@@ -370,3 +384,2 @@ | ||
## .then(\[Function fulfilledHandler\] \[, Function rejectedHandler \]) | ||
@@ -417,2 +430,11 @@ | ||
```js | ||
$q.resolve(['http://some.url', urlPromise]) | ||
.each(function(url, index, length) { | ||
return ping(url) | ||
.catch(function() { | ||
console.warn('Url ' + url + ' does not respond...'); | ||
}) | ||
; | ||
}) | ||
; | ||
``` | ||
@@ -428,2 +450,8 @@ | ||
```js | ||
$q.resolve(values) | ||
// keep only even numbers | ||
.filter(function(val, i, length) { | ||
return !(val % 2); // you can also return a promise here | ||
}) | ||
; | ||
``` | ||
@@ -439,2 +467,8 @@ | ||
```js | ||
$q.resolve(values) | ||
// square | ||
.map(function(val, index, length) { | ||
return val * val; // you can also return a promise here | ||
}) | ||
; | ||
``` | ||
@@ -450,2 +484,12 @@ | ||
```js | ||
promise.resolve({ | ||
prop1: 42, | ||
prop2: somePromise | ||
}) | ||
.props() | ||
.then(function(val) { | ||
// val.prop === 42 | ||
// val.prop2 is the resolveValue of somePromise | ||
}) | ||
; | ||
``` | ||
@@ -461,2 +505,8 @@ | ||
```js | ||
$q.resolve(values) | ||
// sum values | ||
.reduce(function(acc, val, index, length) { | ||
return acc + val; // you can also return a promise here | ||
}, 0) | ||
; | ||
``` | ||
@@ -469,7 +519,4 @@ | ||
Example: | ||
**Not implemented yet** | ||
```js | ||
``` | ||
More documentation on [Bluebird's project](https://github.com/petkaantonov/bluebird/blob/master/API.md#settle---promise) | ||
@@ -483,2 +530,9 @@ | ||
```js | ||
promise.resolve([$q.resolve(42).delay(10), 21, $q.resolve(0).delay(20)]) | ||
// get first x promises that resolve (ignore rejections) | ||
.some(2) | ||
.then(function(vals) { | ||
// vals === [21, 42] | ||
}) | ||
; | ||
``` | ||
@@ -494,2 +548,8 @@ | ||
```js | ||
$q.resolve({ | ||
method: function(arg1, arg2) {} | ||
}) | ||
// calls object's 'method' method with arg1 === 21 & arg2 === 42 | ||
.call('method', 21, 42) | ||
; | ||
``` | ||
@@ -505,2 +565,13 @@ | ||
```js | ||
$q.resolve({ | ||
prop: 42 | ||
}) | ||
.get('prop') | ||
// here value in then will be 42 | ||
; | ||
$q.resolve([21, 42]) | ||
.get(1) | ||
// here value in then will be 42 | ||
; | ||
``` | ||
@@ -516,4 +587,10 @@ | ||
```js | ||
$q.resolve(values) | ||
.return(42) | ||
// here value in then will be 42 | ||
; | ||
``` | ||
Alias: Promise.returns & Promise.thenReturn | ||
More documentation on [Bluebird's project](https://github.com/petkaantonov/bluebird/blob/master/API.md#returndynamic-value---promise) | ||
@@ -527,2 +604,9 @@ | ||
```js | ||
$q.resolve(42) | ||
.tap(function(val) { | ||
console.log(val); | ||
return $q.reolve(21).delay(10); | ||
}) | ||
// here value in then will be 42 but it will sync promise | ||
// on 21 and thus wait for the 10ms delay | ||
``` | ||
@@ -538,4 +622,11 @@ | ||
```js | ||
$q.resolve(42) | ||
.throw(new Error('toto')) | ||
// here the promise will coninue on its error flow with | ||
// the constructed error | ||
; | ||
``` | ||
Alias: Promise.thenThrow | ||
More documentation on [Bluebird's project](https://github.com/petkaantonov/bluebird/blob/master/API.md#throwdynamic-reason---promise) | ||
@@ -570,2 +661,6 @@ | ||
```js | ||
$q.resolve(42) | ||
// wait 10ms before going through with the previous value | ||
.delay(10) | ||
// here value will be 42 in then | ||
``` | ||
@@ -581,2 +676,7 @@ | ||
```js | ||
$q.resolve($q.resolve(42).delay(20)) | ||
// fail if values do not resolve in 10ms max | ||
.timeout(10, 'optional message to construct the TimeoutError with') | ||
// thus here promise will be rejected with a $q.TImeoutError | ||
; | ||
``` | ||
@@ -592,23 +692,36 @@ | ||
```js | ||
``` | ||
$q.reject(42) | ||
.done() // will throw 42 globally | ||
; | ||
More documentation on [Bluebird's project](https://github.com/petkaantonov/bluebird/blob/master/API.md#donefunction-fulfilledhandler--function-rejectedhandler----void) | ||
$q.resolve(42) | ||
.done(function() { | ||
// will throw 42 globally | ||
return $q.reject(42); | ||
}) | ||
; | ||
$q.resolve(42) | ||
.done(function() { | ||
throw 42; // will throw 42 globally | ||
}) | ||
; | ||
## AggregateError() | ||
Example: | ||
```js | ||
$q.reject(42) | ||
.done(null, function() {}) // will not throw | ||
; | ||
``` | ||
More documentation on [Bluebird's project](https://github.com/petkaantonov/bluebird/blob/master/API.md#aggregateerror) | ||
More documentation on [Bluebird's project](https://github.com/petkaantonov/bluebird/blob/master/API.md#donefunction-fulfilledhandler--function-rejectedhandler----void) | ||
# Tests | ||
Work in progress: pull requests are welcome! | ||
The library is tested as much as possible. Right now there are: | ||
* 60 unit tests | ||
* 90 functional tests | ||
We probably still miss tests, PR are welcome! | ||
# You've seen a bug, you'd like a feature | ||
@@ -615,0 +728,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
617403
3703
714
0