diff --git a/lib/toxic-decorators.browser.js b/lib/toxic-decorators.browser.js index abc025a..95b449d 100644 --- a/lib/toxic-decorators.browser.js +++ b/lib/toxic-decorators.browser.js @@ -1,6 +1,6 @@ /** - * toxic-decorators v0.3.0 + * toxic-decorators v0.3.1 * (c) 2017 toxic-johann * Released under GPL-3.0 */ @@ -8,7 +8,7 @@ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : - (factory((global.toxicDecorators = global.toxicDecorators || {}))); + (factory((global.toxicDecorators = {}))); }(this, (function (exports) { 'use strict'; function unwrapExports (x) { @@ -1421,12 +1421,13 @@ function compressOneArgFnArray(fns) { * @param {anything} args */ function warn() { + var _console2, _console3; + var _console = console, - warn = _console.warn, - log = _console.log; + warn = _console.warn; - if (isFunction(warn)) return warn.apply(undefined, arguments); - log.apply(undefined, arguments); + if (isFunction(warn)) return (_console2 = console).warn.apply(_console2, arguments); + (_console3 = console).log.apply(_console3, arguments); } function getDeepProperty(obj, keys) { diff --git a/lib/toxic-decorators.js b/lib/toxic-decorators.js index e828fca..9d88b63 100644 --- a/lib/toxic-decorators.js +++ b/lib/toxic-decorators.js @@ -1,6 +1,6 @@ /** - * toxic-decorators v0.3.0 + * toxic-decorators v0.3.1 * (c) 2017 toxic-johann * Released under GPL-3.0 */ @@ -127,12 +127,13 @@ function compressOneArgFnArray(fns) { * @param {anything} args */ function warn() { + var _console2, _console3; + var _console = console, - warn = _console.warn, - log = _console.log; + warn = _console.warn; - if (toxicPredicateFunctions.isFunction(warn)) return warn.apply(undefined, arguments); - log.apply(undefined, arguments); + if (toxicPredicateFunctions.isFunction(warn)) return (_console2 = console).warn.apply(_console2, arguments); + (_console3 = console).log.apply(_console3, arguments); } function getDeepProperty(obj, keys) { diff --git a/lib/toxic-decorators.min.js b/lib/toxic-decorators.min.js index 383b2ee..c98513b 100644 --- a/lib/toxic-decorators.min.js +++ b/lib/toxic-decorators.min.js @@ -1 +1 @@ -!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r(e.toxicDecorators=e.toxicDecorators||{})}(this,function(e){"use strict";function r(e){return e&&e.__esModule?e.default:e}function t(e,r){return r={exports:{}},e(r,r.exports),r.exports}function n(e){return void 0===e||null===e}function o(e){return Array.isArray(e)}function i(e){return"function"==typeof e}function u(e){return Object(e)===e&&"[object Object]"===String(e)&&!i(e)&&!o(e)}function a(e){return"number"==typeof e}function f(e){return"string"==typeof e||e instanceof String}function c(e){return"boolean"==typeof e}function l(e){return!!e&&("object"===(void 0===e?"undefined":Hr(e))||"function"==typeof e)&&"function"==typeof e.then}function s(e){return n(e)||c(e)||f(e)||a(e)}function p(e,r){return e.bind?e.bind(r):e.apply?function(){for(var t=arguments.length,n=Array(t),o=0;o1&&void 0!==arguments[1]?arguments[1]:"You must pass me an array of function";if(!o(e)||e.length<1)throw new TypeError(r);if(1===e.length){if(!i(e[0]))throw new TypeError(r);return e[0]}return e.reduce(function(e,t){if(!i(t)||!i(e))throw new TypeError(r);return function(r){return p(t,this)(p(e,this)(r))}})}function w(){var e=console,r=e.warn,t=e.log;if(i(r))return r.apply(void 0,arguments);t.apply(void 0,arguments)}function m(e,r){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=t.throwError,u=void 0!==i&&i,a=t.backup;if(f(r)&&(r=r.split(".")),!o(r))throw new TypeError("keys of getDeepProperty must be string or Array");for(var c=[],l=e,s=0,p=r.length;s0?"."+c.join("."):" itself")+" is "+l);return a}l=l[y],c.push(y)}return l}function O(){for(var e=arguments.length,r=Array(e),t=0;t0&&void 0!==arguments[0]?arguments[0]:{},r=e.get,t=e.set,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},u=n.preGet,a=void 0!==u&&u,f=n.preSet,c=void 0===f||f;if(!(i(r)||i(t)||o(r)&&r.length>0||o(t)&&t.length>0))throw new TypeError("@accessor need a getter or setter. If you don't need to add setter/getter. You should remove @accessor");var l="@accessor only accept function or array of function as getter/setter";return r=o(r)?g(r,l):r,t=o(t)?g(t,l):t,function(e,n,o){var u=o||{},f=u.configurable,l=void 0===f||f,s=u.enumerable,y=void 0===s||s,d=i(r),b=i(t),g=function(e){return d?p(r,this)(e):e},m=function(e){return b?p(t,this)(e):e};if(h(o)){var O=o.get,E=o.set,j=i(O),S=i(E);return!j&&d&&w("You are trying to set getter via @accessor on "+n+" without getter. That's not a good idea."),!S&&b&&w("You are trying to set setter via @accessor on "+n+" without setter. That's not a good idea."),{get:j||d?function(){var e=this,r=p(g,this),t=function(){return j?p(O,e)():void 0};return(a?[r,t]:[t,r]).reduce(function(e,r){return r(e)},void 0)}:void 0,set:S||b?function(e){var r=this,t=p(m,this),n=function(e){return S?p(E,r)(e):e};return(c?[t,n]:[n,t]).reduce(function(e,r){return r(e)},e)}:void 0,configurable:l,enumerable:y}}if(v(o)){var A=o.initializer,_=void 0,P=!1;return{get:function(){var e=p(g,this);return P?e(_):(_=p(A,this)(),P=!0,e(_))},set:function(e){var r=p(m,this);return _=c?r(e):e,P=!0,c||r(_),_},configurable:l,enumerable:y}}var T=(o||{}).value;return{get:function(){return p(g,this)(T)},set:function(e){var r=p(m,this);return T=c?r(e):e,c||r(T),T},configurable:l,enumerable:y}}}function j(){for(var e=arguments.length,r=Array(e),t=0;t2&&y(r[2]))throw new Error("You may use @before straightly, @before return decorators, you need to call it");for(var n=r.length-1;n>-1;n--)if(!i(r[n]))throw new TypeError("@before only accept function parameter");return function(e,t,n){if(void 0===n)throw new Error("@before must used on descriptor, are you using it on undefined property?");var u=n.value,a=n.configurable,f=n.enumerable,c=n.writable;if(!i(u))throw new TypeError("@before can only be used on function");return{value:function(){for(var e=this,t=arguments.length,n=Array(t),i=0;i2&&y(r[2]))throw new Error("You may use @after straightly, @after return decorators, you need to call it");var n=g(r,"@after only accept function parameter");return function(e,r,t){if(void 0===t)throw new Error("@after must used on descriptor, are you using it on undefined property?");var o=t.value,u=t.configurable,a=t.enumerable,f=t.writable;if(!i(o))throw new TypeError("@after can only be used on function");return{value:function(){var e=p(o,this).apply(void 0,arguments);return p(n,this)(e)},configurable:u,enumerable:a,writable:f}}}function A(){for(var e=arguments.length,r=Array(e),t=0;t2&&y(r[2]))throw new Error("You may use @initialize straightly, @initialize return decorators, you need to call it");var n=g(r,"@initialize only accept function parameter");return function(e,r,t){if(void 0===t)return{value:p(n,e)(),configurable:!0,writable:!0,enumerable:!0};if(h(t)){var o=!1;return E({get:function(e){return o?e:p(n,this)(e)},set:t.set?function(e){return o=!0,e}:void 0})(e,r,t)}if(v(t)){var i=t.initializer;return{initializer:function(){return p(n,this)(p(i,this)())},configurable:t.configurable,writable:t.writable,enumerable:t.enumerable}}return{value:p(n,this)(t.value),writable:t.writable,configurable:t.configurable,enumerable:t.enumerable}}}function _(e,r,t,n,o,i){var u=t.configurable,a=t.enumerable,f=i.force,c=i.omit,l=Ct(n,o);if(void 0!==l){if(c)return;if(!f)throw new Error("@alias can't set alias on an existing attribute");if(!l.configurable)throw new Error("You are tring to set alias on an existing attribute which its configurable is false. That's impossible. Please check if you have set @frozen on it.")}Wt(n,o,{get:function(){return e[r]},set:function(t){return e[r]=t,r},configurable:u,enumerable:a})}function P(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=r.requirement,u=r.customArgs,a=void 0!==u&&u;return function(){for(var r=arguments.length,u=Array(r>1?r-1:0),f=1;f0&&void 0!==arguments[0]?arguments[0]:{},l=c.exclude,p=void 0===l?[]:l,y=c.include,h=void 0===y?[]:y,d=c.construct,v=void 0!==d&&d,b=c.self,g=void 0!==b&&b;if(!o(p))throw new TypeError("options.exclude must be an array");if(!o(h))throw new TypeError("options.include must be an array");return function(r){var o=i(r);if(!g&&!o)throw new TypeError("@"+e.name+"Class can only be used on class");if(g&&s(r))throw new TypeError("@"+e.name+"Class must be used on non-primitive type value in 'self' mode");var f=g?r:r.prototype;if(n(f))throw new Error("The prototype of the "+r.name+" is empty, please check it");var c=It(f);Ft(f).concat(h).forEach(function(r){var n=c[r];"constructor"===r&&!v||g&&o&&["name","length","prototype"].indexOf(r)>-1||p.indexOf(r)>-1||i(t)&&!1===t(f,r,n,{self:g})||Rt(f,r,(a?e.apply(void 0,Yt(u)):e)(f,r,n))})}}}function T(e,r){if("undefined"==typeof WeakMap)throw new Error("Using @autobind on "+r.name+"() requires WeakMap support due to its use of super."+r.name+"()");qt||(qt=new WeakMap),!1===qt.has(e)&&qt.set(e,new WeakMap);var t=qt.get(e);return!1===t.has(r)&&t.set(r,p(r,e)),t.get(r)}function k(e,r,t){if(1===arguments.length)return Vt()(e);if(!y(t))throw new Error("@autobind must used on descriptor, are you using it on undefined property?");var n=t.value,o=t.configurable;if(!i(n))throw new TypeError("@autobind can only be used on functions, not: "+n+")");var u=e.constructor;return{configurable:o,enumerable:!1,get:function(){var t=this,o=function(){for(var e=arguments.length,r=Array(e),o=0;o1&&void 0!==arguments[1]?arguments[1]:{}).other;if(!i(e)&&!l(e)&&!f(e))throw new TypeError("@waitUntil only accept Function, Promise or String");return function(t,o,u){if(void 0===u)throw new Error("@waituntil must used on descriptor, are you using it on undefined property?");var a=u.value,f=u.configurable;if(!i(a))throw new TypeError("@waituntil can only be used on function, but not "+a);var c=!1,h=[],d=l(e)?function(){return e}:i(e)?e:function(){var t=e.split("."),o=t.slice(-1),i=s(r)?this:r;if(!c){var u=m(i,t.slice(0,-1));if(n(u))return u;var a=Bt(u,o),f=function(e){if(!0===e)for(;h.length>0;)h[0](),h.shift();return e},l=y(a)?E({set:f})(u,o,a):E({set:f})(u,o,{value:void 0,configurable:!0,enumerable:!0,writable:!0});Gt(u,o,l),c=!0}return m(i,t)};return{value:function(){for(var e=this,r=arguments.length,t=Array(r),n=0;n1&&void 0!==arguments[1]?arguments[1]:{},t=r.other,n=r.backup;if(!i(e)&&!f(e))throw new TypeError("@runnable only accept Function or String");return function(r,o,u){if(void 0===u)throw new Error("@runnable must used on descriptor, are you using it on undefined property?");var a=u.value,f=u.configurable;if(!i(a))throw new TypeError("@runnable can only be used on method, but not "+a+" on "+o);var c=i(e)?e:function(){var r=e.split(".");return m(s(t)?this:t,r)};return n=i(n)?n:function(){},{value:function(){return!0===p(c,this).apply(void 0,arguments)?p(a,this).apply(void 0,arguments):p(n,this).apply(void 0,arguments)},enumerable:!1,configurable:f,writable:!1}}}var F=Math.ceil,I=Math.floor,z=function(e){return isNaN(e=+e)?0:(e>0?I:F)(e)},N=function(e){if(void 0==e)throw TypeError("Can't call method on "+e);return e},D=t(function(e){var r=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=r)}),Y=t(function(e){var r=e.exports={version:"2.4.0"};"number"==typeof __e&&(__e=r)}),C=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e},W=function(e,r,t){if(C(e),void 0===r)return e;switch(t){case 1:return function(t){return e.call(r,t)};case 2:return function(t,n){return e.call(r,t,n)};case 3:return function(t,n,o){return e.call(r,t,n,o)}}return function(){return e.apply(r,arguments)}},R=function(e){return"object"==typeof e?null!==e:"function"==typeof e},V=function(e){if(!R(e))throw TypeError(e+" is not an object!");return e},q=function(e){try{return!!e()}catch(e){return!0}},L=!q(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}),B=D.document,G=R(B)&&R(B.createElement),J=function(e){return G?B.createElement(e):{}},K=!L&&!q(function(){return 7!=Object.defineProperty(J("div"),"a",{get:function(){return 7}}).a}),U=function(e,r){if(!R(e))return e;var t,n;if(r&&"function"==typeof(t=e.toString)&&!R(n=t.call(e)))return n;if("function"==typeof(t=e.valueOf)&&!R(n=t.call(e)))return n;if(!r&&"function"==typeof(t=e.toString)&&!R(n=t.call(e)))return n;throw TypeError("Can't convert object to primitive value")},Q=Object.defineProperty,$={f:L?Object.defineProperty:function(e,r,t){if(V(e),r=U(r,!0),V(t),K)try{return Q(e,r,t)}catch(e){}if("get"in t||"set"in t)throw TypeError("Accessors not supported!");return"value"in t&&(e[r]=t.value),e}},H=function(e,r){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:r}},X=L?function(e,r,t){return $.f(e,r,H(1,t))}:function(e,r,t){return e[r]=t,e},Z=function(e,r,t){var n,o,i,u=e&Z.F,a=e&Z.G,f=e&Z.S,c=e&Z.P,l=e&Z.B,s=e&Z.W,p=a?Y:Y[r]||(Y[r]={}),y=p.prototype,h=a?D:f?D[r]:(D[r]||{}).prototype;a&&(t=r);for(n in t)(o=!u&&h&&void 0!==h[n])&&n in p||(i=o?h[n]:t[n],p[n]=a&&"function"!=typeof h[n]?t[n]:l&&o?W(i,D):s&&h[n]==i?function(e){var r=function(r,t,n){if(this instanceof e){switch(arguments.length){case 0:return new e;case 1:return new e(r);case 2:return new e(r,t)}return new e(r,t,n)}return e.apply(this,arguments)};return r.prototype=e.prototype,r}(i):c&&"function"==typeof i?W(Function.call,i):i,c&&((p.virtual||(p.virtual={}))[n]=i,e&Z.R&&y&&!y[n]&&X(y,n,i)))};Z.F=1,Z.G=2,Z.S=4,Z.P=8,Z.B=16,Z.W=32,Z.U=64,Z.R=128;var ee=Z,re=X,te={}.hasOwnProperty,ne=function(e,r){return te.call(e,r)},oe={},ie={}.toString,ue=function(e){return ie.call(e).slice(8,-1)},ae=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==ue(e)?e.split(""):Object(e)},fe=function(e){return ae(N(e))},ce=Math.min,le=function(e){return e>0?ce(z(e),9007199254740991):0},se=Math.max,pe=Math.min,ye=function(e,r){return(e=z(e))<0?se(e+r,0):pe(e,r)},he=D["__core-js_shared__"]||(D["__core-js_shared__"]={}),de=function(e){return he[e]||(he[e]={})},ve=0,be=Math.random(),ge=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++ve+be).toString(36))},we=de("keys"),me=function(e){return we[e]||(we[e]=ge(e))},Oe=function(e){return function(r,t,n){var o,i=fe(r),u=le(i.length),a=ye(n,u);if(e&&t!=t){for(;u>a;)if((o=i[a++])!=o)return!0}else for(;u>a;a++)if((e||a in i)&&i[a]===t)return e||a||0;return!e&&-1}}(!1),Ee=me("IE_PROTO"),je=function(e,r){var t,n=fe(e),o=0,i=[];for(t in n)t!=Ee&&ne(n,t)&&i.push(t);for(;r.length>o;)ne(n,t=r[o++])&&(~Oe(i,t)||i.push(t));return i},Se="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(","),Ae=Object.keys||function(e){return je(e,Se)},_e=L?Object.defineProperties:function(e,r){V(e);for(var t,n=Ae(r),o=n.length,i=0;o>i;)$.f(e,t=n[i++],r[t]);return e},Pe=D.document&&document.documentElement,Te=me("IE_PROTO"),ke=function(){},xe=function(){var e,r=J("iframe"),t=Se.length;for(r.style.display="none",Pe.appendChild(r),r.src="javascript:",(e=r.contentWindow.document).open(),e.write("