Comparing version 2.0.2 to 2.1.0
# crio changelog | ||
#### 2.0.2 | ||
* Fix behavior difference between .concat() and .push() | ||
#### 2.0.1 | ||
@@ -4,0 +7,0 @@ * Switch `CrioArray.prototype.includes` to use bitwise operation instead of index !== -1 (performance) |
@@ -1,1 +0,1 @@ | ||
var crio=function(t){function n(r){if(e[r])return e[r].exports;var i=e[r]={exports:{},id:r,loaded:!1};return t[r].call(i.exports,i,i.exports,n),i.loaded=!0,i.exports}var e={};return n.m=t,n.c=e,n.p="",n(0)}([function(t,n,e){t.exports=e(1)},function(t,n,e){"use strict";function r(t){if(Array.isArray(t)){for(var n=0,e=Array(t.length);n<t.length;n++)e[n]=t[n];return e}return Array.from(t)}function i(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0}),n.CrioObject=n.CrioArray=n.isCrio=n.getRealValue=n.assignOnDeepMatch=void 0;var o=function(){function t(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(n,e,r){return e&&t(n.prototype,e),r&&t(n,r),n}}();e(2),e(56),e(59),e(63);var u=e(65),a=Array.prototype,c=Object.entries,f=Object.freeze,s=Object.keys,l=Object.getOwnPropertyNames,h=Object.prototype,y=Object.values,v=["$$hashCode","$$type","length"],p=function(t){return t instanceof d||t instanceof O},b=function(t){if(!p(t)){if((0,u.isArray)(t))return new d(t);if((0,u.isObject)(t))return new O(t)}return t},g=function(t,n,e){for(var r=!(arguments.length<=3||void 0===arguments[3])&&arguments[3],i=n.length,o=i-1,a=(0,u.isArray)(t)?d:O,c=t.thaw(),f=c,s=void 0,l=0;l<i;l++){var h=n[l]+"",y=c[h];(0,u.isArray)(y)||(0,u.isObject)(y)||(c[h]={}),l===o?(s=(0,u.isArray)(c)?d:O,c[h]=r?s.prototype.merge.apply(c[h],e):e):c=c[h]}var v=new a(f);return(0,u.returnObjectOnlyIfNew)(void 0,v)},d=function(){function t(n){if(i(this,t),p(n))return n;for(var e=n.length,r=0;r<e;r++){var o=b(n[r]);(0,u.setReadOnly)(this,r,o,n.propertyIsEnumerable(r))}return(0,u.setNonEnumerable)(this,"length",e),f(this)}return o(t,[{key:"concat",value:function(){for(var n=arguments.length,e=Array(n),i=0;i<n;i++)e[i]=arguments[i];if(!e.length)return this;var o=[].concat(r(this));return e.forEach(function(t){(0,u.isArray)(t)&&(o=[].concat(r(o),r(t)))}),new t(o)}},{key:"copyWithin",value:function(){var n,e=(n=this.thaw()).copyWithin.apply(n,arguments),r=new t(e);return(0,u.returnObjectOnlyIfNew)(this,r)}},{key:"entries",value:function(){return c(this.thaw())}},{key:"equals",value:function(t){return!!p(t)&&this.$$hashCode===t.$$hashCode}},{key:"every",value:function(t){for(var n=arguments.length<=1||void 0===arguments[1]?this:arguments[1],e=0,r=this.length;e<r;e++)if(!t.call(n,this[e],e,this))return!1;return!0}},{key:"fill",value:function(){var n=this.thaw();return n.fill.apply(n,arguments),new t(n)}},{key:"filter",value:function(n){var e=this,r=arguments.length<=1||void 0===arguments[1]?this:arguments[1],i=s(this).reduce(function(t,i){var o=n.call(r,e[i],+i,e);return o?t.concat(e[i]):t},[]),o=new t(i);return(0,u.returnObjectOnlyIfNew)(this,o)}},{key:"find",value:function(t){for(var n=arguments.length<=1||void 0===arguments[1]?this:arguments[1],e=0;e<this.length;e++){var r=this[e];if(t.call(n,r,e,this))return r}}},{key:"findIndex",value:function(t){for(var n=arguments.length<=1||void 0===arguments[1]?this:arguments[1],e=0;e<this.length;e++)if(t.call(n,this[e],e,this))return e;return-1}},{key:"forEach",value:function(t){var n=this,e=arguments.length<=1||void 0===arguments[1]?this:arguments[1];this.keys().forEach(function(r){t.call(e,n[r],+r,n)})}},{key:"get",value:function(t){return this[t]}},{key:"getIn",value:function(t){if(!(0,u.isArray)(t))throw new Error('Must provide keys as an array, such as ["foo", "bar"].');for(var n=t.length,e=n-1,r=this,i=0;i<n;i++){var o=t[i];if((0,u.isUndefined)(r[o])||i===e)return r[o];r=r[o]}}},{key:"includes",value:function(t){return!!~this.indexOf(t)}},{key:"indexOf",value:function(t){return a.indexOf.call(this,t)}},{key:"join",value:function(){var t=this,n=arguments.length<=0||void 0===arguments[0]?",":arguments[0],e="";return this.keys().forEach(function(r,i){0!==i&&(e+=n),e+=t[r].toString()}),e}},{key:"keys",value:function(){return s(this)}},{key:"lastIndexOf",value:function(t){return a.lastIndexOf.call(this,t)}},{key:"map",value:function(n){var e=this,r=arguments.length<=1||void 0===arguments[1]?this:arguments[1],i=this.keys().map(function(t){return n.call(r,e[t],+t,e)}),o=new t(i);return(0,u.returnObjectOnlyIfNew)(this,o)}},{key:"merge",value:function(){for(var n=p(this)?this.thaw():this,e=arguments.length,r=Array(e),i=0;i<e;i++)r[i]=arguments[i];r.forEach(function(t){n=n.map(function(e,r){return t[r]||n[r]})});var o=new t(n);return(0,u.returnObjectOnlyIfNew)(this,o)}},{key:"mergeIn",value:function(t){if(!(0,u.isArray)(t))throw new Error('Must provide keys as an array, such as ["foo", "bar"].');for(var n=arguments.length,e=Array(n>1?n-1:0),r=1;r<n;r++)e[r-1]=arguments[r];return e.length?g(this,t,e,!0):this}},{key:"mutate",value:function(t){var n=arguments.length<=1||void 0===arguments[1]?this:arguments[1],e=t.call(n,this.thaw(),this),r=b(e);return(0,u.returnObjectOnlyIfNew)(this,r)}},{key:"pop",value:function(){return this.slice(0,this.length-1)}},{key:"push",value:function(){for(var t=arguments.length,n=Array(t),e=0;e<t;e++)n[e]=arguments[e];return this.concat(n)}},{key:"reduce",value:function(t,n){var e=arguments.length<=2||void 0===arguments[2]?this:arguments[2],r=a.reduce.call(this,t,n,e),i=b(r);return i&&i.$$hashCode?(0,u.returnObjectOnlyIfNew)(this,i):i}},{key:"reduceRight",value:function(t,n){var e=arguments.length<=2||void 0===arguments[2]?this:arguments[2],r=a.reduceRight.call(this,t,n,e),i=b(r);return i&&i.$$hashCode?(0,u.returnObjectOnlyIfNew)(this,i):i}},{key:"set",value:function(n,e){var r=+n;if(r>this.length)throw new Error("Cannot set a key for sparsed array on crio objects.");var i=this.thaw();i[r]=e;var o=new t(i);return(0,u.returnObjectOnlyIfNew)(this,o)}},{key:"setIn",value:function(t,n){if(!(0,u.isArray)(t))throw new Error('Must provide keys as an array, such as ["foo", "bar"].');return g(this,t,n)}},{key:"shift",value:function(){return this.slice(1,this.length)}},{key:"slice",value:function(){for(var n,e=arguments.length,r=Array(e),i=0;i<e;i++)r[i]=arguments[i];return r.length?new t((n=a.slice).call.apply(n,[this].concat(r))):this}},{key:"some",value:function(t){for(var n=arguments.length<=1||void 0===arguments[1]?this:arguments[1],e=0,r=this.length;e<r;e++)if(t.call(n,this[e],e,this))return!0;return!1}},{key:"sort",value:function(n){var e=this.thaw().sort(n),r=new t(e);return(0,u.returnObjectOnlyIfNew)(this,r)}},{key:"splice",value:function(){var n=this.thaw();n.splice.apply(n,arguments);var e=new t(n);return(0,u.returnObjectOnlyIfNew)(this,e)}},{key:"thaw",value:function(){return a.map.call(this,function(t){return p(t)?t.thaw():t})}},{key:"toLocaleString",value:function(){return this.toString()}},{key:"toString",value:function(){var t=this,n="CrioArray {";return this.keys().forEach(function(e,r){0!==r&&(n+=", ");var i=t[e],o=p(i)?i.toString():'"'+i+'"';n+=e+": "+o}),n+="}"}},{key:"unshift",value:function(){for(var n=arguments.length,e=Array(n),i=0;i<n;i++)e[i]=arguments[i];return e.length?new t([].concat(e,r(this))):this}},{key:"values",value:function(){return y(this)}},{key:Symbol.iterator,value:function(){var t=this,n=0;return{next:function(){var e=t[n],r=n>=t.length;return n++,{value:e,done:r}}}}},{key:"$$hashCode",get:function(){return(0,u.hash)(this.toString())}},{key:"$$type",get:function(){return"CrioArray"}}]),t}(),O=function(){function t(n){if(i(this,t),p(n))return n;for(var e=l(n).filter(function(t){return v.indexOf(t)===-1}),r=e.length,o=0;o<r;o++){var a=e[o],c=b(n[a]);(0,u.setReadOnly)(this,a,c,n.propertyIsEnumerable(a))}return f(this)}return o(t,[{key:"entries",value:function(){return c(this)}},{key:"equals",value:function(t){return!!p(t)&&this.$$hashCode===t.$$hashCode}},{key:"get",value:function(t){return this[t.toString()]}},{key:"getIn",value:function(t){if(!(0,u.isArray)(t))throw new Error('Must provide keys as an array, such as ["foo", "bar"].');for(var n=t.length,e=n-1,r=this,i=0;i<n;i++){var o=t[i];if((0,u.isUndefined)(r[o])||i===e)return r[o];r=r[o]}}},{key:"hasOwnProperty",value:function(t){return h.hasOwnProperty.call(this,t)}},{key:"isPrototypeOf",value:function(t){return h.isPrototypeOf.call(this,t)}},{key:"keys",value:function(){return s(this)}},{key:"merge",value:function(){for(var n=p(this)?this.thaw():this,e=arguments.length,r=Array(e),i=0;i<e;i++)r[i]=arguments[i];r.forEach(function(t){Object.assign(n,t)});var o=new t(n);return(0,u.returnObjectOnlyIfNew)(this,o)}},{key:"mergeIn",value:function(t){if(!(0,u.isArray)(t))throw new Error('Must provide keys as an array, such as ["foo", "bar"].');for(var n=arguments.length,e=Array(n>1?n-1:0),r=1;r<n;r++)e[r-1]=arguments[r];return e.length?g(this,t,e,!0):this}},{key:"mutate",value:function(t){var n=arguments.length<=1||void 0===arguments[1]?this:arguments[1],e=t.call(n,this.thaw(),this),r=b(e);return(0,u.returnObjectOnlyIfNew)(this,r)}},{key:"propertyIsEnumerable",value:function(t){return h.propertyIsEnumerable.call(this,t)}},{key:"set",value:function(n,e){var r=this.thaw();r[n]=e;var i=new t(r);return(0,u.returnObjectOnlyIfNew)(this,i)}},{key:"setIn",value:function(t,n){if(!(0,u.isArray)(t))throw new Error('Must provide keys as an array, such as ["foo", "bar"].');return g(this,t,n)}},{key:"thaw",value:function(){var t=this;return l(this).reduce(function(n,e){if(v.indexOf(e)===-1){var r=t[e],i=p(r)?r.thaw():r;(0,u.setStandard)(n,e,i,t.propertyIsEnumerable(e))}return n},{})}},{key:"toLocaleString",value:function(){return this.toString()}},{key:"toString",value:function(){var t=this,n="CrioObject {",e=n;return l(this).forEach(function(r){if(v.indexOf(r)===-1){e!==n&&(e+=", ");var i=t[r],o=p(i)?i.toString():'"'+i+'"';e+='"'+r+'": '+o}}),e+="}"}},{key:"valueOf",value:function(){return h.valueOf.call(this)}},{key:"values",value:function(){return y(this)}},{key:Symbol.iterator,value:function(){var t=this,n=s(this),e=0;return{next:function(){var r=n[e],i=t[r],o=e>=t.length;return e++,{value:i,done:o}}}}},{key:"$$hashCode",get:function(){return(0,u.hash)(this.toString())}},{key:"$$type",get:function(){return"CrioObject"}},{key:"length",get:function(){var t=l(this).filter(function(t){return v.indexOf(t)===-1});return t.length}}]),t}(),w=function(t){return(0,u.isArray)(t)?new d(t):(0,u.isObject)(t)?new O(t):t};n.assignOnDeepMatch=g,n.getRealValue=b,n.isCrio=p,n.CrioArray=d,n.CrioObject=O,n.default=w},function(t,n,e){e(3),e(52),e(54),e(55),t.exports=e(9).Symbol},function(t,n,e){"use strict";var r=e(4),i=e(5),o=e(6),u=e(8),a=e(18),c=e(22).KEY,f=e(7),s=e(23),l=e(24),h=e(19),y=e(25),v=e(26),p=e(27),b=e(29),g=e(42),d=e(45),O=e(12),w=e(32),m=e(16),j=e(17),k=e(46),x=e(49),S=e(51),E=e(11),A=e(30),I=S.f,P=E.f,$=x.f,N=r.Symbol,C=r.JSON,_=C&&C.stringify,M="prototype",F=y("_hidden"),T=y("toPrimitive"),R={}.propertyIsEnumerable,U=s("symbol-registry"),W=s("symbols"),D=s("op-symbols"),z=Object[M],J="function"==typeof N,G=r.QObject,K=!G||!G[M]||!G[M].findChild,L=o&&f(function(){return 7!=k(P({},"a",{get:function(){return P(this,"a",{value:7}).a}})).a})?function(t,n,e){var r=I(z,n);r&&delete z[n],P(t,n,e),r&&t!==z&&P(z,n,r)}:P,q=function(t){var n=W[t]=k(N[M]);return n._k=t,n},B=J&&"symbol"==typeof N.iterator?function(t){return"symbol"==typeof t}:function(t){return t instanceof N},V=function(t,n,e){return t===z&&V(D,n,e),O(t),n=m(n,!0),O(e),i(W,n)?(e.enumerable?(i(t,F)&&t[F][n]&&(t[F][n]=!1),e=k(e,{enumerable:j(0,!1)})):(i(t,F)||P(t,F,j(1,{})),t[F][n]=!0),L(t,n,e)):P(t,n,e)},Y=function(t,n){O(t);for(var e,r=g(n=w(n)),i=0,o=r.length;o>i;)V(t,e=r[i++],n[e]);return t},Q=function(t,n){return void 0===n?k(t):Y(k(t),n)},H=function(t){var n=R.call(this,t=m(t,!0));return!(this===z&&i(W,t)&&!i(D,t))&&(!(n||!i(this,t)||!i(W,t)||i(this,F)&&this[F][t])||n)},X=function(t,n){if(t=w(t),n=m(n,!0),t!==z||!i(W,n)||i(D,n)){var e=I(t,n);return!e||!i(W,n)||i(t,F)&&t[F][n]||(e.enumerable=!0),e}},Z=function(t){for(var n,e=$(w(t)),r=[],o=0;e.length>o;)i(W,n=e[o++])||n==F||n==c||r.push(n);return r},tt=function(t){for(var n,e=t===z,r=$(e?D:w(t)),o=[],u=0;r.length>u;)!i(W,n=r[u++])||e&&!i(z,n)||o.push(W[n]);return o};J||(N=function(){if(this instanceof N)throw TypeError("Symbol is not a constructor!");var t=h(arguments.length>0?arguments[0]:void 0),n=function(e){this===z&&n.call(D,e),i(this,F)&&i(this[F],t)&&(this[F][t]=!1),L(this,t,j(1,e))};return o&&K&&L(z,t,{configurable:!0,set:n}),q(t)},a(N[M],"toString",function(){return this._k}),S.f=X,E.f=V,e(50).f=x.f=Z,e(44).f=H,e(43).f=tt,o&&!e(28)&&a(z,"propertyIsEnumerable",H,!0),v.f=function(t){return q(y(t))}),u(u.G+u.W+u.F*!J,{Symbol:N});for(var nt="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),et=0;nt.length>et;)y(nt[et++]);for(var nt=A(y.store),et=0;nt.length>et;)p(nt[et++]);u(u.S+u.F*!J,"Symbol",{"for":function(t){return i(U,t+="")?U[t]:U[t]=N(t)},keyFor:function(t){if(B(t))return b(U,t);throw TypeError(t+" is not a symbol!")},useSetter:function(){K=!0},useSimple:function(){K=!1}}),u(u.S+u.F*!J,"Object",{create:Q,defineProperty:V,defineProperties:Y,getOwnPropertyDescriptor:X,getOwnPropertyNames:Z,getOwnPropertySymbols:tt}),C&&u(u.S+u.F*(!J||f(function(){var t=N();return"[null]"!=_([t])||"{}"!=_({a:t})||"{}"!=_(Object(t))})),"JSON",{stringify:function(t){if(void 0!==t&&!B(t)){for(var n,e,r=[t],i=1;arguments.length>i;)r.push(arguments[i++]);return n=r[1],"function"==typeof n&&(e=n),!e&&d(n)||(n=function(t,n){if(e&&(n=e.call(this,t,n)),!B(n))return n}),r[1]=n,_.apply(C,r)}}}),N[M][T]||e(10)(N[M],T,N[M].valueOf),l(N,"Symbol"),l(Math,"Math",!0),l(r.JSON,"JSON",!0)},function(t,n){var e=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=e)},function(t,n){var e={}.hasOwnProperty;t.exports=function(t,n){return e.call(t,n)}},function(t,n,e){t.exports=!e(7)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,n){t.exports=function(t){try{return!!t()}catch(n){return!0}}},function(t,n,e){var r=e(4),i=e(9),o=e(10),u=e(18),a=e(20),c="prototype",f=function(t,n,e){var s,l,h,y,v=t&f.F,p=t&f.G,b=t&f.S,g=t&f.P,d=t&f.B,O=p?r:b?r[n]||(r[n]={}):(r[n]||{})[c],w=p?i:i[n]||(i[n]={}),m=w[c]||(w[c]={});p&&(e=n);for(s in e)l=!v&&O&&void 0!==O[s],h=(l?O:e)[s],y=d&&l?a(h,r):g&&"function"==typeof h?a(Function.call,h):h,O&&u(O,s,h,t&f.U),w[s]!=h&&o(w,s,y),g&&m[s]!=h&&(m[s]=h)};r.core=i,f.F=1,f.G=2,f.S=4,f.P=8,f.B=16,f.W=32,f.U=64,f.R=128,t.exports=f},function(t,n){var e=t.exports={version:"2.4.0"};"number"==typeof __e&&(__e=e)},function(t,n,e){var r=e(11),i=e(17);t.exports=e(6)?function(t,n,e){return r.f(t,n,i(1,e))}:function(t,n,e){return t[n]=e,t}},function(t,n,e){var r=e(12),i=e(14),o=e(16),u=Object.defineProperty;n.f=e(6)?Object.defineProperty:function(t,n,e){if(r(t),n=o(n,!0),r(e),i)try{return u(t,n,e)}catch(a){}if("get"in e||"set"in e)throw TypeError("Accessors not supported!");return"value"in e&&(t[n]=e.value),t}},function(t,n,e){var r=e(13);t.exports=function(t){if(!r(t))throw TypeError(t+" is not an object!");return t}},function(t,n){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,n,e){t.exports=!e(6)&&!e(7)(function(){return 7!=Object.defineProperty(e(15)("div"),"a",{get:function(){return 7}}).a})},function(t,n,e){var r=e(13),i=e(4).document,o=r(i)&&r(i.createElement);t.exports=function(t){return o?i.createElement(t):{}}},function(t,n,e){var r=e(13);t.exports=function(t,n){if(!r(t))return t;var e,i;if(n&&"function"==typeof(e=t.toString)&&!r(i=e.call(t)))return i;if("function"==typeof(e=t.valueOf)&&!r(i=e.call(t)))return i;if(!n&&"function"==typeof(e=t.toString)&&!r(i=e.call(t)))return i;throw TypeError("Can't convert object to primitive value")}},function(t,n){t.exports=function(t,n){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:n}}},function(t,n,e){var r=e(4),i=e(10),o=e(5),u=e(19)("src"),a="toString",c=Function[a],f=(""+c).split(a);e(9).inspectSource=function(t){return c.call(t)},(t.exports=function(t,n,e,a){var c="function"==typeof e;c&&(o(e,"name")||i(e,"name",n)),t[n]!==e&&(c&&(o(e,u)||i(e,u,t[n]?""+t[n]:f.join(String(n)))),t===r?t[n]=e:a?t[n]?t[n]=e:i(t,n,e):(delete t[n],i(t,n,e)))})(Function.prototype,a,function(){return"function"==typeof this&&this[u]||c.call(this)})},function(t,n){var e=0,r=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++e+r).toString(36))}},function(t,n,e){var r=e(21);t.exports=function(t,n,e){if(r(t),void 0===n)return t;switch(e){case 1:return function(e){return t.call(n,e)};case 2:return function(e,r){return t.call(n,e,r)};case 3:return function(e,r,i){return t.call(n,e,r,i)}}return function(){return t.apply(n,arguments)}}},function(t,n){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,n,e){var r=e(19)("meta"),i=e(13),o=e(5),u=e(11).f,a=0,c=Object.isExtensible||function(){return!0},f=!e(7)(function(){return c(Object.preventExtensions({}))}),s=function(t){u(t,r,{value:{i:"O"+ ++a,w:{}}})},l=function(t,n){if(!i(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!o(t,r)){if(!c(t))return"F";if(!n)return"E";s(t)}return t[r].i},h=function(t,n){if(!o(t,r)){if(!c(t))return!0;if(!n)return!1;s(t)}return t[r].w},y=function(t){return f&&v.NEED&&c(t)&&!o(t,r)&&s(t),t},v=t.exports={KEY:r,NEED:!1,fastKey:l,getWeak:h,onFreeze:y}},function(t,n,e){var r=e(4),i="__core-js_shared__",o=r[i]||(r[i]={});t.exports=function(t){return o[t]||(o[t]={})}},function(t,n,e){var r=e(11).f,i=e(5),o=e(25)("toStringTag");t.exports=function(t,n,e){t&&!i(t=e?t:t.prototype,o)&&r(t,o,{configurable:!0,value:n})}},function(t,n,e){var r=e(23)("wks"),i=e(19),o=e(4).Symbol,u="function"==typeof o,a=t.exports=function(t){return r[t]||(r[t]=u&&o[t]||(u?o:i)("Symbol."+t))};a.store=r},function(t,n,e){n.f=e(25)},function(t,n,e){var r=e(4),i=e(9),o=e(28),u=e(26),a=e(11).f;t.exports=function(t){var n=i.Symbol||(i.Symbol=o?{}:r.Symbol||{});"_"==t.charAt(0)||t in n||a(n,t,{value:u.f(t)})}},function(t,n){t.exports=!1},function(t,n,e){var r=e(30),i=e(32);t.exports=function(t,n){for(var e,o=i(t),u=r(o),a=u.length,c=0;a>c;)if(o[e=u[c++]]===n)return e}},function(t,n,e){var r=e(31),i=e(41);t.exports=Object.keys||function(t){return r(t,i)}},function(t,n,e){var r=e(5),i=e(32),o=e(36)(!1),u=e(40)("IE_PROTO");t.exports=function(t,n){var e,a=i(t),c=0,f=[];for(e in a)e!=u&&r(a,e)&&f.push(e);for(;n.length>c;)r(a,e=n[c++])&&(~o(f,e)||f.push(e));return f}},function(t,n,e){var r=e(33),i=e(35);t.exports=function(t){return r(i(t))}},function(t,n,e){var r=e(34);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==r(t)?t.split(""):Object(t)}},function(t,n){var e={}.toString;t.exports=function(t){return e.call(t).slice(8,-1)}},function(t,n){t.exports=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t}},function(t,n,e){var r=e(32),i=e(37),o=e(39);t.exports=function(t){return function(n,e,u){var a,c=r(n),f=i(c.length),s=o(u,f);if(t&&e!=e){for(;f>s;)if(a=c[s++],a!=a)return!0}else for(;f>s;s++)if((t||s in c)&&c[s]===e)return t||s||0;return!t&&-1}}},function(t,n,e){var r=e(38),i=Math.min;t.exports=function(t){return t>0?i(r(t),9007199254740991):0}},function(t,n){var e=Math.ceil,r=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?r:e)(t)}},function(t,n,e){var r=e(38),i=Math.max,o=Math.min;t.exports=function(t,n){return t=r(t),t<0?i(t+n,0):o(t,n)}},function(t,n,e){var r=e(23)("keys"),i=e(19);t.exports=function(t){return r[t]||(r[t]=i(t))}},function(t,n){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(t,n,e){var r=e(30),i=e(43),o=e(44);t.exports=function(t){var n=r(t),e=i.f;if(e)for(var u,a=e(t),c=o.f,f=0;a.length>f;)c.call(t,u=a[f++])&&n.push(u);return n}},function(t,n){n.f=Object.getOwnPropertySymbols},function(t,n){n.f={}.propertyIsEnumerable},function(t,n,e){var r=e(34);t.exports=Array.isArray||function(t){return"Array"==r(t)}},function(t,n,e){var r=e(12),i=e(47),o=e(41),u=e(40)("IE_PROTO"),a=function(){},c="prototype",f=function(){var t,n=e(15)("iframe"),r=o.length,i=">";for(n.style.display="none",e(48).appendChild(n),n.src="javascript:",t=n.contentWindow.document,t.open(),t.write("<script>document.F=Object</script"+i),t.close(),f=t.F;r--;)delete f[c][o[r]];return f()};t.exports=Object.create||function(t,n){var e;return null!==t?(a[c]=r(t),e=new a,a[c]=null,e[u]=t):e=f(),void 0===n?e:i(e,n)}},function(t,n,e){var r=e(11),i=e(12),o=e(30);t.exports=e(6)?Object.defineProperties:function(t,n){i(t);for(var e,u=o(n),a=u.length,c=0;a>c;)r.f(t,e=u[c++],n[e]);return t}},function(t,n,e){t.exports=e(4).document&&document.documentElement},function(t,n,e){var r=e(32),i=e(50).f,o={}.toString,u="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],a=function(t){try{return i(t)}catch(n){return u.slice()}};t.exports.f=function(t){return u&&"[object Window]"==o.call(t)?a(t):i(r(t))}},function(t,n,e){var r=e(31),i=e(41).concat("length","prototype");n.f=Object.getOwnPropertyNames||function(t){return r(t,i)}},function(t,n,e){var r=e(44),i=e(17),o=e(32),u=e(16),a=e(5),c=e(14),f=Object.getOwnPropertyDescriptor;n.f=e(6)?f:function(t,n){if(t=o(t),n=u(n,!0),c)try{return f(t,n)}catch(e){}if(a(t,n))return i(!r.f.call(t,n),t[n])}},function(t,n,e){"use strict";var r=e(53),i={};i[e(25)("toStringTag")]="z",i+""!="[object z]"&&e(18)(Object.prototype,"toString",function(){return"[object "+r(this)+"]"},!0)},function(t,n,e){var r=e(34),i=e(25)("toStringTag"),o="Arguments"==r(function(){return arguments}()),u=function(t,n){try{return t[n]}catch(e){}};t.exports=function(t){var n,e,a;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(e=u(n=Object(t),i))?e:o?r(n):"Object"==(a=r(n))&&"function"==typeof n.callee?"Arguments":a}},function(t,n,e){e(27)("asyncIterator")},function(t,n,e){e(27)("observable")},function(t,n,e){e(57),t.exports=e(9).Object.entries},function(t,n,e){var r=e(8),i=e(58)(!0);r(r.S,"Object",{entries:function(t){return i(t)}})},function(t,n,e){var r=e(30),i=e(32),o=e(44).f;t.exports=function(t){return function(n){for(var e,u=i(n),a=r(u),c=a.length,f=0,s=[];c>f;)o.call(u,e=a[f++])&&s.push(t?[e,u[e]]:u[e]);return s}}},function(t,n,e){e(60),t.exports=e(9).Object.keys},function(t,n,e){var r=e(61),i=e(30);e(62)("keys",function(){return function(t){return i(r(t))}})},function(t,n,e){var r=e(35);t.exports=function(t){return Object(r(t))}},function(t,n,e){var r=e(8),i=e(9),o=e(7);t.exports=function(t,n){var e=(i.Object||{})[t]||Object[t],u={};u[t]=n(e),r(r.S+r.F*o(function(){e(1)}),"Object",u)}},function(t,n,e){e(64),t.exports=e(9).Object.values},function(t,n,e){var r=e(8),i=e(58)(!1);r(r.S,"Object",{values:function(t){return i(t)}})},function(t,n,e){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(n,"__esModule",{value:!0}),n.setStandard=n.setReadOnly=n.setNonEnumerable=n.returnObjectOnlyIfNew=n.isUndefined=n.isObject=n.isArray=n.hash=void 0;var i=e(66),o=r(i),u=13,a=function(t){return Object.prototype.toString.call(t)},c=function(t){return o.default.x86.hash32(t,u)},f=function(t){return"[object Array]"===a(t)||!(!t||"CrioArray"!==t.$$type)},s=function(t){return"[object Object]"===a(t)&&!!t&&"CrioArray"!==t.$$type||!(!t||"CrioObject"!==t.$$type)},l=function(t){return void 0===t},h=function(){var t=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],n=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return t.$$hashCode!==n.$$hashCode?n:t},y=function(t,n,e){Object.defineProperty(t,n,{configurable:!1,enumerable:!1,value:e,writable:!1})},v=function(t,n,e){var r=arguments.length<=3||void 0===arguments[3]||arguments[3];Object.defineProperty(t,n,{configurable:!1,enumerable:r,value:e,writable:!1})},p=function(t,n,e){var r=arguments.length<=3||void 0===arguments[3]||arguments[3];Object.defineProperty(t,n,{configurable:!0,enumerable:r,value:e,writable:!0})};n.hash=c,n.isArray=f,n.isObject=s,n.isUndefined=l,n.returnObjectOnlyIfNew=h,n.setNonEnumerable=y,n.setReadOnly=v,n.setStandard=p},function(t,n){t.exports=void 0}]); | ||
var crio=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){t.exports=r(1)},function(t,n,r){"use strict";function e(t){if(Array.isArray(t)){for(var n=0,r=Array(t.length);n<t.length;n++)r[n]=t[n];return r}return Array.from(t)}function o(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0}),n.CrioObject=n.CrioArray=n.isCrio=n.getRealValue=n.assignOnDeepMatch=void 0;var i=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])}return t},u=function(){function t(t,n){for(var r=0;r<n.length;r++){var e=n[r];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(t,e.key,e)}}return function(n,r,e){return r&&t(n.prototype,r),e&&t(n,e),n}}();r(2),r(56),r(59),r(63);var a=r(65),c=Array.prototype,f=Object.entries,s=Object.freeze,l=Object.keys,h=Object.getOwnPropertyNames,v=Object.prototype,y=Object.values,p="CrioArray",g="CrioObject",d=["$$hashCode","$$type","length"],b=function(t){return(0,a.isCrio)(t)?t:(0,a.isArray)(t)?new w(t):(0,a.isObject)(t)?new k(t):t},O=function(t,n,r){return(0,a.hasChanged)(t,n)?new r(n):t},m=function(t,n,r){var e=!(arguments.length<=3||void 0===arguments[3])&&arguments[3],o=n.length,i=o-1,u=(0,a.isArray)(t)?w:k,c=t.thaw(),f=c,s=void 0;return(0,a.forEach)(n,function(t,n){var o=c[t];(0,a.isArray)(o)||(0,a.isObject)(o)||(c[t]={}),n===i?(s=(0,a.isArray)(c)?w:k,c[t]=e?s.prototype.merge.apply(c[t],r):r):c=c[t]}),O(t,f,u)},w=function(){function t(n){var r=this;if(o(this,t),(0,a.isCrio)(n))return n;var e=n.length;(0,a.forEach)(n,function(t,n){r[n]=b(t)});var i=(0,a.hash)(n);return(0,a.setNonEnumerable)(this,"$$hashCode",i),(0,a.setNonEnumerable)(this,"length",e),s(this)}return u(t,[{key:"concat",value:function(){for(var n=arguments.length,r=Array(n),e=0;e<n;e++)r[e]=arguments[e];if(!r.length)return this;var o=(0,a.shallowCloneArray)(this),i=c.concat.apply(o,r);return new t(i)}},{key:"copyWithin",value:function(){for(var n=(0,a.shallowCloneArray)(this),r=arguments.length,e=Array(r),o=0;o<r;o++)e[o]=arguments[o];var i=c.copyWithin.apply(n,e);return O(this,i,t)}},{key:"entries",value:function(){return f(this)}},{key:"equals",value:function(t){return!!(0,a.isCrio)(t)&&this.$$hashCode===t.$$hashCode}},{key:"every",value:function(t){var n=arguments.length<=1||void 0===arguments[1]?this:arguments[1];return c.every.call(n,t)}},{key:"fill",value:function(){for(var n=(0,a.shallowCloneArray)(this),r=arguments.length,e=Array(r),o=0;o<r;o++)e[o]=arguments[o];return c.fill.apply(n,e),O(this,n,t)}},{key:"filter",value:function(n){var r=arguments.length<=1||void 0===arguments[1]?this:arguments[1],e=c.filter.call(this,n,r);return O(this,e,t)}},{key:"find",value:function(t){for(var n=arguments.length<=1||void 0===arguments[1]?this:arguments[1],r=-1,e=void 0;++r<this.length;)if(e=this[r],t.call(n,e,r,this))return e}},{key:"findIndex",value:function(t){for(var n=arguments.length<=1||void 0===arguments[1]?this:arguments[1],r=-1;++r<this.length;)if(t.call(n,this[r],r,this))return r;return-1}},{key:"forEach",value:function(t){var n=arguments.length<=1||void 0===arguments[1]?this:arguments[1];c.forEach.call(this,t,n)}},{key:"get",value:function(t){return this[t]}},{key:"getIn",value:function(t){if(!(0,a.isArray)(t))throw new Error('Must provide keys as an array, such as ["foo", "bar"].');for(var n=t.length,r=n-1,e=this,o=-1,i=void 0;++o<n;){if(i=t[o],(0,a.isUndefined)(e[i])||o===r)return e[i];e=e[i]}}},{key:"includes",value:function(t){return!!~this.indexOf(t)}},{key:"indexOf",value:function(t){return c.indexOf.call(this,t)}},{key:"join",value:function(){var t=arguments.length<=0||void 0===arguments[0]?",":arguments[0];return c.join.call(this,t)}},{key:"keys",value:function(){return l(this)}},{key:"lastIndexOf",value:function(t){return c.lastIndexOf.call(this,t)}},{key:"map",value:function(n){var r=arguments.length<=1||void 0===arguments[1]?this:arguments[1],e=c.map.call(this,n,r);return O(this,e,t)}},{key:"merge",value:function(){for(var n=(0,a.isCrio)(this)?(0,a.shallowCloneArray)(this):this,r=arguments.length,e=Array(r),o=0;o<r;o++)e[o]=arguments[o];return(0,a.forEach)(e,function(t){n=n.map(function(r,e){return t[e]||n[e]})},this),O(this,n,t)}},{key:"mergeIn",value:function(t){if(!(0,a.isArray)(t))throw new Error('Must provide keys as an array, such as ["foo", "bar"].');for(var n=arguments.length,r=Array(n>1?n-1:0),e=1;e<n;e++)r[e-1]=arguments[e];return r.length?m(this,t,r,!0):this}},{key:"mutate",value:function(t){var n=arguments.length<=1||void 0===arguments[1]?this:arguments[1],r=t.call(n,this.thaw(),this);return(0,a.hasChanged)(this,r)?b(r):this}},{key:"pop",value:function(){return this.slice(0,this.length-1)}},{key:"push",value:function(){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.concat(n)}},{key:"reduce",value:function(t,n){var r=arguments.length<=2||void 0===arguments[2]?this:arguments[2],e=c.reduce.call(this,t,n,r);return(0,a.hasChanged)(this,e)?b(e):this}},{key:"reduceRight",value:function(t,n){var r=arguments.length<=2||void 0===arguments[2]?this:arguments[2],e=c.reduceRight.call(this,t,n,r);return(0,a.hasChanged)(this,e)?b(e):this}},{key:"set",value:function(n,r){var e=+n;if(e>this.length)throw new Error("Cannot set a key for sparsed array on crio objects.");var o=(0,a.shallowCloneArray)(this);return o[e]=r,O(this,o,t)}},{key:"setIn",value:function(t,n){if(!(0,a.isArray)(t))throw new Error('Must provide keys as an array, such as ["foo", "bar"].');return m(this,t,n)}},{key:"shift",value:function(){return this.slice(1,this.length)}},{key:"slice",value:function(){for(var n=arguments.length,r=Array(n),e=0;e<n;e++)r[e]=arguments[e];return r.length?new t(c.slice.apply(this,r)):this}},{key:"some",value:function(t){var n=arguments.length<=1||void 0===arguments[1]?this:arguments[1];return c.some.call(this,t,n)}},{key:"sort",value:function(n){var r=(0,a.shallowCloneArray)(this),e=c.sort.call(r,n);return O(this,e,t)}},{key:"splice",value:function(){var n=(0,a.shallowCloneArray)(this);return n.splice.apply(n,arguments),O(this,n,t)}},{key:"thaw",value:function(){return c.map.call(this,function(t){return(0,a.isCrio)(t)?t.thaw():t})}},{key:"toLocaleString",value:function(){return(0,a.stringify)(this)}},{key:"toString",value:function(){return(0,a.stringify)(this)}},{key:"unshift",value:function(){for(var n=arguments.length,r=Array(n),o=0;o<n;o++)r[o]=arguments[o];return r.length?new t([].concat(r,e(this))):this}},{key:"values",value:function(){return y(this)}},{key:Symbol.iterator,value:function(){var t=this,n=0;return{next:function(){var r=t[n],e=n>=t.length;return n++,{value:r,done:e}}}}},{key:"$$type",get:function(){return p}}]),t}(),k=function(){function t(n){var r=this;if(o(this,t),(0,a.isCrio)(n))return n;var e=h(n),i=0;(0,a.forEach)(e,function(t){~d.indexOf(t)||(r[t]=b(n[t]),i++)},this);var u=(0,a.hash)(n);return(0,a.setNonEnumerable)(this,"$$hashCode",u),(0,a.setNonEnumerable)(this,"length",i),s(this)}return u(t,[{key:"entries",value:function(){return f(this)}},{key:"equals",value:function(t){return!!(0,a.isCrio)(t)&&this.$$hashCode===t.$$hashCode}},{key:"get",value:function(t){return this[t.toString()]}},{key:"getIn",value:function(t){if(!(0,a.isArray)(t))throw new Error('Must provide keys as an array, such as ["foo", "bar"].');for(var n=t.length,r=n-1,e=this,o=-1,i=void 0;++o<n;){if(i=t[o],(0,a.isUndefined)(e[i])||o===r)return e[i];e=e[i]}}},{key:"hasOwnProperty",value:function(t){return v.hasOwnProperty.call(this,t)}},{key:"isPrototypeOf",value:function(t){return v.isPrototypeOf.call(this,t)}},{key:"keys",value:function(){return l(this)}},{key:"merge",value:function(){for(var n=(0,a.isCrio)(this)?i({},this):this,r=arguments.length,e=Array(r),o=0;o<r;o++)e[o]=arguments[o];return(0,a.forEach)(e,function(t){Object.assign(n,t)},n),O(this,n,t)}},{key:"mergeIn",value:function(t){if(!(0,a.isArray)(t))throw new Error('Must provide keys as an array, such as ["foo", "bar"].');for(var n=arguments.length,r=Array(n>1?n-1:0),e=1;e<n;e++)r[e-1]=arguments[e];return r.length?m(this,t,r,!0):this}},{key:"mutate",value:function(t){var n=arguments.length<=1||void 0===arguments[1]?this:arguments[1],r=t.call(n,this.thaw(),this);return(0,a.hasChanged)(this,r)?b(r):this}},{key:"propertyIsEnumerable",value:function(t){return v.propertyIsEnumerable.call(this,t)}},{key:"set",value:function(n,r){var e=i({},this);return e[n]=r,O(this,e,t)}},{key:"setIn",value:function(t,n){if(!(0,a.isArray)(t))throw new Error('Must provide keys as an array, such as ["foo", "bar"].');return m(this,t,n)}},{key:"thaw",value:function(){var t=this,n=h(this),r={};return(0,a.forEach)(n,function(n){if(d.indexOf(n)===-1){var e=t[n],o=(0,a.isCrio)(e)?e.thaw():e;(0,a.setStandard)(r,n,o,t.propertyIsEnumerable(n))}},this),r}},{key:"toLocaleString",value:function(){return(0,a.stringify)(this)}},{key:"toString",value:function(){return(0,a.stringify)(this)}},{key:"valueOf",value:function(){return v.valueOf.call(this)}},{key:"values",value:function(){return y(this)}},{key:Symbol.iterator,value:function(){var t=this,n=l(this),r=0;return{next:function(){var e=n[r],o=t[e],i=r>=t.length;return r++,{value:o,done:i}}}}},{key:"$$type",get:function(){return g}}]),t}(),j=function(t){return(0,a.isArray)(t)?new w(t):(0,a.isObject)(t)?new k(t):t};n.assignOnDeepMatch=m,n.getRealValue=b,n.isCrio=a.isCrio,n.CrioArray=w,n.CrioObject=k,n.default=j},function(t,n,r){r(3),r(52),r(54),r(55),t.exports=r(9).Symbol},function(t,n,r){"use strict";var e=r(4),o=r(5),i=r(6),u=r(8),a=r(18),c=r(22).KEY,f=r(7),s=r(23),l=r(24),h=r(19),v=r(25),y=r(26),p=r(27),g=r(29),d=r(42),b=r(45),O=r(12),m=r(32),w=r(16),k=r(17),j=r(46),x=r(49),S=r(51),C=r(11),E=r(30),A=S.f,P=C.f,$=x.f,_=e.Symbol,I=e.JSON,M=I&&I.stringify,N="prototype",F=v("_hidden"),T=v("toPrimitive"),D={}.propertyIsEnumerable,R=s("symbol-registry"),U=s("symbols"),W=s("op-symbols"),z=Object[N],J="function"==typeof _,G=e.QObject,K=!G||!G[N]||!G[N].findChild,L=i&&f(function(){return 7!=j(P({},"a",{get:function(){return P(this,"a",{value:7}).a}})).a})?function(t,n,r){var e=A(z,n);e&&delete z[n],P(t,n,r),e&&t!==z&&P(z,n,e)}:P,q=function(t){var n=U[t]=j(_[N]);return n._k=t,n},B=J&&"symbol"==typeof _.iterator?function(t){return"symbol"==typeof t}:function(t){return t instanceof _},V=function(t,n,r){return t===z&&V(W,n,r),O(t),n=w(n,!0),O(r),o(U,n)?(r.enumerable?(o(t,F)&&t[F][n]&&(t[F][n]=!1),r=j(r,{enumerable:k(0,!1)})):(o(t,F)||P(t,F,k(1,{})),t[F][n]=!0),L(t,n,r)):P(t,n,r)},Y=function(t,n){O(t);for(var r,e=d(n=m(n)),o=0,i=e.length;i>o;)V(t,r=e[o++],n[r]);return t},H=function(t,n){return void 0===n?j(t):Y(j(t),n)},Q=function(t){var n=D.call(this,t=w(t,!0));return!(this===z&&o(U,t)&&!o(W,t))&&(!(n||!o(this,t)||!o(U,t)||o(this,F)&&this[F][t])||n)},X=function(t,n){if(t=m(t),n=w(n,!0),t!==z||!o(U,n)||o(W,n)){var r=A(t,n);return!r||!o(U,n)||o(t,F)&&t[F][n]||(r.enumerable=!0),r}},Z=function(t){for(var n,r=$(m(t)),e=[],i=0;r.length>i;)o(U,n=r[i++])||n==F||n==c||e.push(n);return e},tt=function(t){for(var n,r=t===z,e=$(r?W:m(t)),i=[],u=0;e.length>u;)!o(U,n=e[u++])||r&&!o(z,n)||i.push(U[n]);return i};J||(_=function(){if(this instanceof _)throw TypeError("Symbol is not a constructor!");var t=h(arguments.length>0?arguments[0]:void 0),n=function(r){this===z&&n.call(W,r),o(this,F)&&o(this[F],t)&&(this[F][t]=!1),L(this,t,k(1,r))};return i&&K&&L(z,t,{configurable:!0,set:n}),q(t)},a(_[N],"toString",function(){return this._k}),S.f=X,C.f=V,r(50).f=x.f=Z,r(44).f=Q,r(43).f=tt,i&&!r(28)&&a(z,"propertyIsEnumerable",Q,!0),y.f=function(t){return q(v(t))}),u(u.G+u.W+u.F*!J,{Symbol:_});for(var nt="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),rt=0;nt.length>rt;)v(nt[rt++]);for(var nt=E(v.store),rt=0;nt.length>rt;)p(nt[rt++]);u(u.S+u.F*!J,"Symbol",{"for":function(t){return o(R,t+="")?R[t]:R[t]=_(t)},keyFor:function(t){if(B(t))return g(R,t);throw TypeError(t+" is not a symbol!")},useSetter:function(){K=!0},useSimple:function(){K=!1}}),u(u.S+u.F*!J,"Object",{create:H,defineProperty:V,defineProperties:Y,getOwnPropertyDescriptor:X,getOwnPropertyNames:Z,getOwnPropertySymbols:tt}),I&&u(u.S+u.F*(!J||f(function(){var t=_();return"[null]"!=M([t])||"{}"!=M({a:t})||"{}"!=M(Object(t))})),"JSON",{stringify:function(t){if(void 0!==t&&!B(t)){for(var n,r,e=[t],o=1;arguments.length>o;)e.push(arguments[o++]);return n=e[1],"function"==typeof n&&(r=n),!r&&b(n)||(n=function(t,n){if(r&&(n=r.call(this,t,n)),!B(n))return n}),e[1]=n,M.apply(I,e)}}}),_[N][T]||r(10)(_[N],T,_[N].valueOf),l(_,"Symbol"),l(Math,"Math",!0),l(e.JSON,"JSON",!0)},function(t,n){var r=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=r)},function(t,n){var r={}.hasOwnProperty;t.exports=function(t,n){return r.call(t,n)}},function(t,n,r){t.exports=!r(7)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,n){t.exports=function(t){try{return!!t()}catch(n){return!0}}},function(t,n,r){var e=r(4),o=r(9),i=r(10),u=r(18),a=r(20),c="prototype",f=function(t,n,r){var s,l,h,v,y=t&f.F,p=t&f.G,g=t&f.S,d=t&f.P,b=t&f.B,O=p?e:g?e[n]||(e[n]={}):(e[n]||{})[c],m=p?o:o[n]||(o[n]={}),w=m[c]||(m[c]={});p&&(r=n);for(s in r)l=!y&&O&&void 0!==O[s],h=(l?O:r)[s],v=b&&l?a(h,e):d&&"function"==typeof h?a(Function.call,h):h,O&&u(O,s,h,t&f.U),m[s]!=h&&i(m,s,v),d&&w[s]!=h&&(w[s]=h)};e.core=o,f.F=1,f.G=2,f.S=4,f.P=8,f.B=16,f.W=32,f.U=64,f.R=128,t.exports=f},function(t,n){var r=t.exports={version:"2.4.0"};"number"==typeof __e&&(__e=r)},function(t,n,r){var e=r(11),o=r(17);t.exports=r(6)?function(t,n,r){return e.f(t,n,o(1,r))}:function(t,n,r){return t[n]=r,t}},function(t,n,r){var e=r(12),o=r(14),i=r(16),u=Object.defineProperty;n.f=r(6)?Object.defineProperty:function(t,n,r){if(e(t),n=i(n,!0),e(r),o)try{return u(t,n,r)}catch(a){}if("get"in r||"set"in r)throw TypeError("Accessors not supported!");return"value"in r&&(t[n]=r.value),t}},function(t,n,r){var e=r(13);t.exports=function(t){if(!e(t))throw TypeError(t+" is not an object!");return t}},function(t,n){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,n,r){t.exports=!r(6)&&!r(7)(function(){return 7!=Object.defineProperty(r(15)("div"),"a",{get:function(){return 7}}).a})},function(t,n,r){var e=r(13),o=r(4).document,i=e(o)&&e(o.createElement);t.exports=function(t){return i?o.createElement(t):{}}},function(t,n,r){var e=r(13);t.exports=function(t,n){if(!e(t))return t;var r,o;if(n&&"function"==typeof(r=t.toString)&&!e(o=r.call(t)))return o;if("function"==typeof(r=t.valueOf)&&!e(o=r.call(t)))return o;if(!n&&"function"==typeof(r=t.toString)&&!e(o=r.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},function(t,n){t.exports=function(t,n){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:n}}},function(t,n,r){var e=r(4),o=r(10),i=r(5),u=r(19)("src"),a="toString",c=Function[a],f=(""+c).split(a);r(9).inspectSource=function(t){return c.call(t)},(t.exports=function(t,n,r,a){var c="function"==typeof r;c&&(i(r,"name")||o(r,"name",n)),t[n]!==r&&(c&&(i(r,u)||o(r,u,t[n]?""+t[n]:f.join(String(n)))),t===e?t[n]=r:a?t[n]?t[n]=r:o(t,n,r):(delete t[n],o(t,n,r)))})(Function.prototype,a,function(){return"function"==typeof this&&this[u]||c.call(this)})},function(t,n){var r=0,e=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++r+e).toString(36))}},function(t,n,r){var e=r(21);t.exports=function(t,n,r){if(e(t),void 0===n)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)}}return function(){return t.apply(n,arguments)}}},function(t,n){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,n,r){var e=r(19)("meta"),o=r(13),i=r(5),u=r(11).f,a=0,c=Object.isExtensible||function(){return!0},f=!r(7)(function(){return c(Object.preventExtensions({}))}),s=function(t){u(t,e,{value:{i:"O"+ ++a,w:{}}})},l=function(t,n){if(!o(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!i(t,e)){if(!c(t))return"F";if(!n)return"E";s(t)}return t[e].i},h=function(t,n){if(!i(t,e)){if(!c(t))return!0;if(!n)return!1;s(t)}return t[e].w},v=function(t){return f&&y.NEED&&c(t)&&!i(t,e)&&s(t),t},y=t.exports={KEY:e,NEED:!1,fastKey:l,getWeak:h,onFreeze:v}},function(t,n,r){var e=r(4),o="__core-js_shared__",i=e[o]||(e[o]={});t.exports=function(t){return i[t]||(i[t]={})}},function(t,n,r){var e=r(11).f,o=r(5),i=r(25)("toStringTag");t.exports=function(t,n,r){t&&!o(t=r?t:t.prototype,i)&&e(t,i,{configurable:!0,value:n})}},function(t,n,r){var e=r(23)("wks"),o=r(19),i=r(4).Symbol,u="function"==typeof i,a=t.exports=function(t){return e[t]||(e[t]=u&&i[t]||(u?i:o)("Symbol."+t))};a.store=e},function(t,n,r){n.f=r(25)},function(t,n,r){var e=r(4),o=r(9),i=r(28),u=r(26),a=r(11).f;t.exports=function(t){var n=o.Symbol||(o.Symbol=i?{}:e.Symbol||{});"_"==t.charAt(0)||t in n||a(n,t,{value:u.f(t)})}},function(t,n){t.exports=!1},function(t,n,r){var e=r(30),o=r(32);t.exports=function(t,n){for(var r,i=o(t),u=e(i),a=u.length,c=0;a>c;)if(i[r=u[c++]]===n)return r}},function(t,n,r){var e=r(31),o=r(41);t.exports=Object.keys||function(t){return e(t,o)}},function(t,n,r){var e=r(5),o=r(32),i=r(36)(!1),u=r(40)("IE_PROTO");t.exports=function(t,n){var r,a=o(t),c=0,f=[];for(r in a)r!=u&&e(a,r)&&f.push(r);for(;n.length>c;)e(a,r=n[c++])&&(~i(f,r)||f.push(r));return f}},function(t,n,r){var e=r(33),o=r(35);t.exports=function(t){return e(o(t))}},function(t,n,r){var e=r(34);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==e(t)?t.split(""):Object(t)}},function(t,n){var r={}.toString;t.exports=function(t){return r.call(t).slice(8,-1)}},function(t,n){t.exports=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t}},function(t,n,r){var e=r(32),o=r(37),i=r(39);t.exports=function(t){return function(n,r,u){var a,c=e(n),f=o(c.length),s=i(u,f);if(t&&r!=r){for(;f>s;)if(a=c[s++],a!=a)return!0}else for(;f>s;s++)if((t||s in c)&&c[s]===r)return t||s||0;return!t&&-1}}},function(t,n,r){var e=r(38),o=Math.min;t.exports=function(t){return t>0?o(e(t),9007199254740991):0}},function(t,n){var r=Math.ceil,e=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?e:r)(t)}},function(t,n,r){var e=r(38),o=Math.max,i=Math.min;t.exports=function(t,n){return t=e(t),t<0?o(t+n,0):i(t,n)}},function(t,n,r){var e=r(23)("keys"),o=r(19);t.exports=function(t){return e[t]||(e[t]=o(t))}},function(t,n){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(t,n,r){var e=r(30),o=r(43),i=r(44);t.exports=function(t){var n=e(t),r=o.f;if(r)for(var u,a=r(t),c=i.f,f=0;a.length>f;)c.call(t,u=a[f++])&&n.push(u);return n}},function(t,n){n.f=Object.getOwnPropertySymbols},function(t,n){n.f={}.propertyIsEnumerable},function(t,n,r){var e=r(34);t.exports=Array.isArray||function(t){return"Array"==e(t)}},function(t,n,r){var e=r(12),o=r(47),i=r(41),u=r(40)("IE_PROTO"),a=function(){},c="prototype",f=function(){var t,n=r(15)("iframe"),e=i.length,o=">";for(n.style.display="none",r(48).appendChild(n),n.src="javascript:",t=n.contentWindow.document,t.open(),t.write("<script>document.F=Object</script"+o),t.close(),f=t.F;e--;)delete f[c][i[e]];return f()};t.exports=Object.create||function(t,n){var r;return null!==t?(a[c]=e(t),r=new a,a[c]=null,r[u]=t):r=f(),void 0===n?r:o(r,n)}},function(t,n,r){var e=r(11),o=r(12),i=r(30);t.exports=r(6)?Object.defineProperties:function(t,n){o(t);for(var r,u=i(n),a=u.length,c=0;a>c;)e.f(t,r=u[c++],n[r]);return t}},function(t,n,r){t.exports=r(4).document&&document.documentElement},function(t,n,r){var e=r(32),o=r(50).f,i={}.toString,u="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],a=function(t){try{return o(t)}catch(n){return u.slice()}};t.exports.f=function(t){return u&&"[object Window]"==i.call(t)?a(t):o(e(t))}},function(t,n,r){var e=r(31),o=r(41).concat("length","prototype");n.f=Object.getOwnPropertyNames||function(t){return e(t,o)}},function(t,n,r){var e=r(44),o=r(17),i=r(32),u=r(16),a=r(5),c=r(14),f=Object.getOwnPropertyDescriptor;n.f=r(6)?f:function(t,n){if(t=i(t),n=u(n,!0),c)try{return f(t,n)}catch(r){}if(a(t,n))return o(!e.f.call(t,n),t[n])}},function(t,n,r){"use strict";var e=r(53),o={};o[r(25)("toStringTag")]="z",o+""!="[object z]"&&r(18)(Object.prototype,"toString",function(){return"[object "+e(this)+"]"},!0)},function(t,n,r){var e=r(34),o=r(25)("toStringTag"),i="Arguments"==e(function(){return arguments}()),u=function(t,n){try{return t[n]}catch(r){}};t.exports=function(t){var n,r,a;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(r=u(n=Object(t),o))?r:i?e(n):"Object"==(a=e(n))&&"function"==typeof n.callee?"Arguments":a}},function(t,n,r){r(27)("asyncIterator")},function(t,n,r){r(27)("observable")},function(t,n,r){r(57),t.exports=r(9).Object.entries},function(t,n,r){var e=r(8),o=r(58)(!0);e(e.S,"Object",{entries:function(t){return o(t)}})},function(t,n,r){var e=r(30),o=r(32),i=r(44).f;t.exports=function(t){return function(n){for(var r,u=o(n),a=e(u),c=a.length,f=0,s=[];c>f;)i.call(u,r=a[f++])&&s.push(t?[r,u[r]]:u[r]);return s}}},function(t,n,r){r(60),t.exports=r(9).Object.keys},function(t,n,r){var e=r(61),o=r(30);r(62)("keys",function(){return function(t){return o(e(t))}})},function(t,n,r){var e=r(35);t.exports=function(t){return Object(e(t))}},function(t,n,r){var e=r(8),o=r(9),i=r(7);t.exports=function(t,n){var r=(o.Object||{})[t]||Object[t],u={};u[t]=n(r),e(e.S+e.F*i(function(){r(1)}),"Object",u)}},function(t,n,r){r(64),t.exports=r(9).Object.values},function(t,n,r){var e=r(8),o=r(58)(!1);e(e.S,"Object",{values:function(t){return o(t)}})},function(t,n,r){"use strict";function e(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(n,"__esModule",{value:!0}),n.stringify=n.shallowCloneArray=n.setStandard=n.setNonEnumerable=n.returnObjectOnlyIfNew=n.isUndefined=n.isObject=n.isCrio=n.isArray=n.hash=n.hasChanged=n.forEach=void 0;var o=r(66),i=e(o),u=r(67),a=e(u),c=i.default.SHA1,f={maxDepth:25,indent:" "},s=(0,a.default)(f),l="[object Array]",h="[object Object]",v=function C(t){if(!b(t)&&!m(t))return t.toString();for(var n=Object.keys(t),r="",e=n.length,o=-1,i=void 0,u=void 0,a=void 0,c=void 0,f=void 0;++o<e;)if(u=n[o],a=t[u],m(a))r+="|"+u+":"+C(a)+"|";else if(b(a)){for(i=[],c=a.length,f=-1;++f<c;)i.push(C(a[f]));i.length>0&&(r+=u+":["+i.join(",")+"]")}else r+="|"+u+":"+a+"|";return r},y=function(t,n,r){for(var e=t.length,o=-1;++o<e;)n.call(r,t[o],o,t)},p=function(t){return Object.prototype.toString.call(t)},g=function(t,n){var r=d(n);return t.$$hashCode!==r},d=function(t){var n=v(t);return c(n).toString()},b=function(t){return p(t)===l||!(!t||"CrioArray"!==t.$$type)},O=function(t){return!(!t||!t.$$type)},m=function(t){return p(t)===h&&!!t&&"CrioArray"!==t.$$type||!(!t||"CrioObject"!==t.$$type)},w=function(t){return void 0===t},k=function(){var t=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],n=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return t.$$hashCode!==n.$$hashCode?n:t},j=function(t){var n=[];return y(t,function(t,r){n[r]=t},t),n},x=function(t,n,r){Object.defineProperty(t,n,{configurable:!1,enumerable:!1,value:r,writable:!1})},S=function(t,n,r){var e=arguments.length<=3||void 0===arguments[3]||arguments[3];Object.defineProperty(t,n,{configurable:!0,enumerable:e,value:r,writable:!0})};n.forEach=y,n.hasChanged=g,n.hash=d,n.isArray=b,n.isCrio=O,n.isObject=m,n.isUndefined=w,n.returnObjectOnlyIfNew=k,n.setNonEnumerable=x,n.setStandard=S,n.shallowCloneArray=j,n.stringify=s},function(t,n){t.exports=void 0},function(t,n){t.exports=void 0}]); |
1983
lib/index.js
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
value: true | ||
}); | ||
exports.CrioObject = exports.CrioArray = exports.isCrio = exports.getRealValue = exports.assignOnDeepMatch = undefined; | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
@@ -33,15 +35,8 @@ | ||
var CRIO_ARRAY_TYPE = 'CrioArray'; | ||
var CRIO_OBJECT_TYPE = 'CrioObject'; | ||
var NATIVE_KEYS = ['$$hashCode', '$$type', 'length']; | ||
/** | ||
* is object a CrioArray or CrioObject | ||
* | ||
* @param {any} object | ||
* @returns {boolean} | ||
*/ | ||
var isCrio = function isCrio(object) { | ||
return object instanceof CrioArray || object instanceof CrioObject; | ||
}; | ||
/** | ||
* if the value is not a crio and is an array or object, convert | ||
@@ -54,16 +49,34 @@ * it to crio and return it, else just return it | ||
var getRealValue = function getRealValue(value) { | ||
if (!isCrio(value)) { | ||
if ((0, _utils.isArray)(value)) { | ||
return new CrioArray(value); | ||
} | ||
if ((0, _utils.isCrio)(value)) { | ||
return value; | ||
} | ||
if ((0, _utils.isObject)(value)) { | ||
return new CrioObject(value); | ||
} | ||
} | ||
if ((0, _utils.isArray)(value)) { | ||
return new CrioArray(value); | ||
} | ||
return value; | ||
if ((0, _utils.isObject)(value)) { | ||
return new CrioObject(value); | ||
} | ||
return value; | ||
}; | ||
/** | ||
* based on the hashCode, return a new Crio if things have changed, else return the original crio | ||
* | ||
* @param {CrioArray|CrioObject} crio | ||
* @param {array<any>|object} newObject | ||
* @param {CrioArray|CrioObject} Constructor | ||
* @returns {CrioArray|CrioObject|array<any>|object} | ||
*/ | ||
var returnCorrectObject = function returnCorrectObject(crio, newObject, Constructor) { | ||
if ((0, _utils.hasChanged)(crio, newObject)) { | ||
return new Constructor(newObject); | ||
} | ||
return crio; | ||
}; | ||
/** | ||
* on deep match via setIn or mergeIn, perform assignment | ||
@@ -78,1261 +91,1161 @@ * | ||
var assignOnDeepMatch = function assignOnDeepMatch(object, keys, value) { | ||
var isMerge = arguments.length <= 3 || arguments[3] === undefined ? false : arguments[3]; | ||
var isMerge = arguments.length <= 3 || arguments[3] === undefined ? false : arguments[3]; | ||
var length = keys.length; | ||
var lastIndex = length - 1; | ||
var FinalCrio = (0, _utils.isArray)(object) ? CrioArray : CrioObject; | ||
var length = keys.length; | ||
var lastIndex = length - 1; | ||
var FinalCrio = (0, _utils.isArray)(object) ? CrioArray : CrioObject; | ||
var currentObject = object.thaw(), | ||
referenceToCurrentObject = currentObject, | ||
Crio = void 0; | ||
var currentObject = object.thaw(), | ||
referenceToCurrentObject = currentObject, | ||
Crio = void 0; | ||
for (var index = 0; index < length; index++) { | ||
var key = keys[index] + ''; | ||
var currentValue = currentObject[key]; | ||
(0, _utils.forEach)(keys, function (key, keyIndex) { | ||
var currentValue = currentObject[key]; | ||
if (!(0, _utils.isArray)(currentValue) && !(0, _utils.isObject)(currentValue)) { | ||
currentObject[key] = {}; | ||
} | ||
if (!(0, _utils.isArray)(currentValue) && !(0, _utils.isObject)(currentValue)) { | ||
currentObject[key] = {}; | ||
} | ||
if (index === lastIndex) { | ||
Crio = (0, _utils.isArray)(currentObject) ? CrioArray : CrioObject; | ||
if (keyIndex === lastIndex) { | ||
Crio = (0, _utils.isArray)(currentObject) ? CrioArray : CrioObject; | ||
currentObject[key] = isMerge ? Crio.prototype.merge.apply(currentObject[key], value) : value; | ||
} else { | ||
currentObject = currentObject[key]; | ||
} | ||
currentObject[key] = isMerge ? Crio.prototype.merge.apply(currentObject[key], value) : value; | ||
} else { | ||
currentObject = currentObject[key]; | ||
} | ||
}); | ||
var crioedObject = new FinalCrio(referenceToCurrentObject); | ||
return (0, _utils.returnObjectOnlyIfNew)(undefined, crioedObject); | ||
return returnCorrectObject(object, referenceToCurrentObject, FinalCrio); | ||
}; | ||
var CrioArray = function () { | ||
function CrioArray(array) { | ||
_classCallCheck(this, CrioArray); | ||
function CrioArray(array) { | ||
var _this = this; | ||
if (isCrio(array)) { | ||
return array; | ||
} | ||
_classCallCheck(this, CrioArray); | ||
var length = array.length; | ||
if ((0, _utils.isCrio)(array)) { | ||
return array; | ||
} | ||
for (var index = 0; index < length; index++) { | ||
var value = getRealValue(array[index]); | ||
var length = array.length; | ||
(0, _utils.setReadOnly)(this, index, value, array.propertyIsEnumerable(index)); | ||
} | ||
(0, _utils.forEach)(array, function (item, index) { | ||
_this[index] = getRealValue(item); | ||
}); | ||
(0, _utils.setNonEnumerable)(this, 'length', length); | ||
var hashCode = (0, _utils.hash)(array); | ||
return OBJECT_FREEZE(this); | ||
} | ||
(0, _utils.setNonEnumerable)(this, '$$hashCode', hashCode); | ||
(0, _utils.setNonEnumerable)(this, 'length', length); | ||
/** | ||
* return unique hash of this values | ||
* | ||
* @return {number} | ||
*/ | ||
return OBJECT_FREEZE(this); | ||
} | ||
/** | ||
* return type of CrioArray | ||
* | ||
* @return {string} | ||
*/ | ||
_createClass(CrioArray, [{ | ||
key: 'concat', | ||
_createClass(CrioArray, [{ | ||
key: 'concat', | ||
/** | ||
* based on items passed, combine with this to create new CrioArray | ||
* | ||
* @param {array<array>} arrays | ||
* @returns {CrioArray} | ||
*/ | ||
value: function concat() { | ||
for (var _len = arguments.length, arrays = Array(_len), _key = 0; _key < _len; _key++) { | ||
arrays[_key] = arguments[_key]; | ||
} | ||
if (!arrays.length) { | ||
return this; | ||
} | ||
/** | ||
* based on items passed, combine with this to create new CrioArray | ||
* | ||
* @param {array<array>} arrays | ||
* @returns {CrioArray} | ||
*/ | ||
value: function concat() { | ||
for (var _len = arguments.length, arrays = Array(_len), _key = 0; _key < _len; _key++) { | ||
arrays[_key] = arguments[_key]; | ||
} | ||
var clone = [].concat(_toConsumableArray(this)); | ||
if (!arrays.length) { | ||
return this; | ||
} | ||
arrays.forEach(function (array) { | ||
if ((0, _utils.isArray)(array)) { | ||
clone = [].concat(_toConsumableArray(clone), _toConsumableArray(array)); | ||
} | ||
}); | ||
var clone = (0, _utils.shallowCloneArray)(this); | ||
return new CrioArray(clone); | ||
} | ||
var concattedArray = ARRAY_PROTOTYPE.concat.apply(clone, arrays); | ||
/** | ||
* based on arguments passed, return new CrioArray with copyWithin applied | ||
* | ||
* @param {array<any>} args | ||
* @returns {CrioArray} | ||
*/ | ||
return new CrioArray(concattedArray); | ||
} | ||
}, { | ||
key: 'copyWithin', | ||
value: function copyWithin() { | ||
var _thaw; | ||
/** | ||
* based on arguments passed, return new CrioArray with copyWithin applied | ||
* | ||
* @param {array<any>} args | ||
* @returns {CrioArray} | ||
*/ | ||
var copiedClone = (_thaw = this.thaw()).copyWithin.apply(_thaw, arguments); | ||
var crioedClone = new CrioArray(copiedClone); | ||
}, { | ||
key: 'copyWithin', | ||
value: function copyWithin() { | ||
var clone = (0, _utils.shallowCloneArray)(this); | ||
return (0, _utils.returnObjectOnlyIfNew)(this, crioedClone); | ||
} | ||
for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { | ||
args[_key2] = arguments[_key2]; | ||
} | ||
/** | ||
* returns an oterable array of [index, value] pairs | ||
* | ||
* @returns {array<array>} | ||
*/ | ||
var copiedClone = ARRAY_PROTOTYPE.copyWithin.apply(clone, args); | ||
}, { | ||
key: 'entries', | ||
value: function entries() { | ||
return OBJECT_ENTRIES(this.thaw()); | ||
} | ||
return returnCorrectObject(this, copiedClone, CrioArray); | ||
} | ||
/** | ||
* is the object passed equal in value to this | ||
* | ||
* @param {any} object | ||
* @returns {boolean} | ||
*/ | ||
/** | ||
* returns an oterable array of [index, value] pairs | ||
* | ||
* @returns {array<array>} | ||
*/ | ||
}, { | ||
key: 'equals', | ||
value: function equals(object) { | ||
if (!isCrio(object)) { | ||
return false; | ||
} | ||
}, { | ||
key: 'entries', | ||
value: function entries() { | ||
return OBJECT_ENTRIES(this); | ||
} | ||
return this.$$hashCode === object.$$hashCode; | ||
} | ||
/** | ||
* is the object passed equal in value to this | ||
* | ||
* @param {any} object | ||
* @returns {boolean} | ||
*/ | ||
/** | ||
* does the function applied to every value in this return truthy | ||
* | ||
* @param {function} fn | ||
* @param {any} thisArg | ||
* @returns {boolean} | ||
*/ | ||
}, { | ||
key: 'equals', | ||
value: function equals(object) { | ||
if (!(0, _utils.isCrio)(object)) { | ||
return false; | ||
} | ||
}, { | ||
key: 'every', | ||
value: function every(fn) { | ||
var thisArg = arguments.length <= 1 || arguments[1] === undefined ? this : arguments[1]; | ||
return this.$$hashCode === object.$$hashCode; | ||
} | ||
for (var index = 0, length = this.length; index < length; index++) { | ||
if (!fn.call(thisArg, this[index], index, this)) { | ||
return false; | ||
} | ||
} | ||
/** | ||
* does the function applied to every value in this return truthy | ||
* | ||
* @param {function} fn | ||
* @param {any} thisArg | ||
* @returns {boolean} | ||
*/ | ||
return true; | ||
} | ||
}, { | ||
key: 'every', | ||
value: function every(fn) { | ||
var thisArg = arguments.length <= 1 || arguments[1] === undefined ? this : arguments[1]; | ||
/** | ||
* fill this based on arguments and return new CrioArray | ||
* | ||
* @param {array<any>} args | ||
* @returns {CrioArray} | ||
*/ | ||
return ARRAY_PROTOTYPE.every.call(thisArg, fn); | ||
} | ||
}, { | ||
key: 'fill', | ||
value: function fill() { | ||
var clone = this.thaw(); | ||
/** | ||
* fill this based on arguments and return new CrioArray | ||
* | ||
* @param {array<any>} args | ||
* @returns {CrioArray} | ||
*/ | ||
clone.fill.apply(clone, arguments); | ||
}, { | ||
key: 'fill', | ||
value: function fill() { | ||
var clone = (0, _utils.shallowCloneArray)(this); | ||
return new CrioArray(clone); | ||
} | ||
for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { | ||
args[_key3] = arguments[_key3]; | ||
} | ||
/** | ||
* based on return values of fn being truthy, return a new reduced CrioArray | ||
* from this | ||
* | ||
* @param {function} fn | ||
* @param {any} thisArg | ||
* @returns {CrioArray} | ||
*/ | ||
ARRAY_PROTOTYPE.fill.apply(clone, args); | ||
}, { | ||
key: 'filter', | ||
value: function filter(fn) { | ||
var _this = this; | ||
return returnCorrectObject(this, clone, CrioArray); | ||
} | ||
var thisArg = arguments.length <= 1 || arguments[1] === undefined ? this : arguments[1]; | ||
/** | ||
* based on return values of fn being truthy, return a new reduced CrioArray | ||
* from this | ||
* | ||
* @param {function} fn | ||
* @param {any} thisArg | ||
* @returns {CrioArray} | ||
*/ | ||
var filteredArray = OBJECT_KEYS(this).reduce(function (array, key) { | ||
var result = fn.call(thisArg, _this[key], +key, _this); | ||
}, { | ||
key: 'filter', | ||
value: function filter(fn) { | ||
var thisArg = arguments.length <= 1 || arguments[1] === undefined ? this : arguments[1]; | ||
if (result) { | ||
return array.concat(_this[key]); | ||
} | ||
var filteredArray = ARRAY_PROTOTYPE.filter.call(this, fn, thisArg); | ||
return array; | ||
}, []); | ||
var crioedArray = new CrioArray(filteredArray); | ||
return returnCorrectObject(this, filteredArray, CrioArray); | ||
} | ||
return (0, _utils.returnObjectOnlyIfNew)(this, crioedArray); | ||
} | ||
/** | ||
* find a specific value in the CrioArray and return it, else return undefined | ||
* | ||
* @param {function} fn | ||
* @param {any} thisArg | ||
* @returns {any} | ||
*/ | ||
/** | ||
* find a specific value in the CrioArray and return it, else return undefined | ||
* | ||
* @param {function} fn | ||
* @param {any} thisArg | ||
* @returns {any} | ||
*/ | ||
}, { | ||
key: 'find', | ||
value: function find(fn) { | ||
var thisArg = arguments.length <= 1 || arguments[1] === undefined ? this : arguments[1]; | ||
}, { | ||
key: 'find', | ||
value: function find(fn) { | ||
var thisArg = arguments.length <= 1 || arguments[1] === undefined ? this : arguments[1]; | ||
var index = -1, | ||
value = void 0; | ||
for (var index = 0; index < this.length; index++) { | ||
var value = this[index]; | ||
while (++index < this.length) { | ||
value = this[index]; | ||
if (fn.call(thisArg, value, index, this)) { | ||
return value; | ||
} | ||
} | ||
return undefined; | ||
if (fn.call(thisArg, value, index, this)) { | ||
return value; | ||
} | ||
} | ||
/** | ||
* find a specific value in the CrioArray and return its index, else return -1 | ||
* | ||
* @param {function} fn | ||
* @param {any} thisArg | ||
* @returns {number} | ||
*/ | ||
return undefined; | ||
} | ||
}, { | ||
key: 'findIndex', | ||
value: function findIndex(fn) { | ||
var thisArg = arguments.length <= 1 || arguments[1] === undefined ? this : arguments[1]; | ||
/** | ||
* find a specific value in the CrioArray and return its index, else return -1 | ||
* | ||
* @param {function} fn | ||
* @param {any} thisArg | ||
* @returns {number} | ||
*/ | ||
for (var index = 0; index < this.length; index++) { | ||
if (fn.call(thisArg, this[index], index, this)) { | ||
return index; | ||
} | ||
} | ||
}, { | ||
key: 'findIndex', | ||
value: function findIndex(fn) { | ||
var thisArg = arguments.length <= 1 || arguments[1] === undefined ? this : arguments[1]; | ||
return -1; | ||
} | ||
var index = -1; | ||
/** | ||
* iterate over this and execute fn for each value | ||
* | ||
* @param {function} fn | ||
* @param {any} thisArg | ||
*/ | ||
}, { | ||
key: 'forEach', | ||
value: function forEach(fn) { | ||
var _this2 = this; | ||
var thisArg = arguments.length <= 1 || arguments[1] === undefined ? this : arguments[1]; | ||
this.keys().forEach(function (key) { | ||
fn.call(thisArg, _this2[key], +key, _this2); | ||
}); | ||
while (++index < this.length) { | ||
if (fn.call(thisArg, this[index], index, this)) { | ||
return index; | ||
} | ||
} | ||
/** | ||
* retrieve the value at index from this | ||
* | ||
* @param {number} index | ||
* @returns {any} | ||
*/ | ||
return -1; | ||
} | ||
}, { | ||
key: 'get', | ||
value: function get(index) { | ||
return this[index]; | ||
} | ||
/** | ||
* iterate over this and execute fn for each value | ||
* | ||
* @param {function} fn | ||
* @param {any} thisArg | ||
*/ | ||
/** | ||
* return value at nested point based on keys in this | ||
* | ||
* @param {array<string|number>} keys | ||
* @return {any} | ||
*/ | ||
}, { | ||
key: 'forEach', | ||
value: function forEach(fn) { | ||
var thisArg = arguments.length <= 1 || arguments[1] === undefined ? this : arguments[1]; | ||
}, { | ||
key: 'getIn', | ||
value: function getIn(keys) { | ||
if (!(0, _utils.isArray)(keys)) { | ||
throw new Error('Must provide keys as an array, such as ["foo", "bar"].'); | ||
} | ||
ARRAY_PROTOTYPE.forEach.call(this, fn, thisArg); | ||
} | ||
var length = keys.length; | ||
var lastIndex = length - 1; | ||
/** | ||
* retrieve the value at index from this | ||
* | ||
* @param {number} index | ||
* @returns {any} | ||
*/ | ||
var currentObject = this; | ||
}, { | ||
key: 'get', | ||
value: function get(index) { | ||
return this[index]; | ||
} | ||
for (var index = 0; index < length; index++) { | ||
var key = keys[index]; | ||
/** | ||
* return value at nested point based on keys in this | ||
* | ||
* @param {array<string|number>} keys | ||
* @return {any} | ||
*/ | ||
if ((0, _utils.isUndefined)(currentObject[key]) || index === lastIndex) { | ||
return currentObject[key]; | ||
} | ||
}, { | ||
key: 'getIn', | ||
value: function getIn(keys) { | ||
if (!(0, _utils.isArray)(keys)) { | ||
throw new Error('Must provide keys as an array, such as ["foo", "bar"].'); | ||
} | ||
currentObject = currentObject[key]; | ||
} | ||
} | ||
}, { | ||
key: 'includes', | ||
var length = keys.length; | ||
var lastIndex = length - 1; | ||
var currentObject = this, | ||
index = -1, | ||
key = void 0; | ||
/** | ||
* does this have a value of item contained in it | ||
* | ||
* @param {any} item | ||
* @returns {boolean} | ||
*/ | ||
value: function includes(item) { | ||
return !!~this.indexOf(item); | ||
} | ||
while (++index < length) { | ||
key = keys[index]; | ||
/** | ||
* what is the index of item in this (if not found, defaults to -1) | ||
* | ||
* @param {any} item | ||
* @returns {number} | ||
*/ | ||
}, { | ||
key: 'indexOf', | ||
value: function indexOf(item) { | ||
return ARRAY_PROTOTYPE.indexOf.call(this, item); | ||
if ((0, _utils.isUndefined)(currentObject[key]) || index === lastIndex) { | ||
return currentObject[key]; | ||
} | ||
/** | ||
* joins this into string based on separator delimiting between values | ||
* | ||
* @param {string} separator | ||
* @returns {string} | ||
*/ | ||
currentObject = currentObject[key]; | ||
} | ||
} | ||
}, { | ||
key: 'includes', | ||
}, { | ||
key: 'join', | ||
value: function join() { | ||
var _this3 = this; | ||
var separator = arguments.length <= 0 || arguments[0] === undefined ? ',' : arguments[0]; | ||
/** | ||
* does this have a value of item contained in it | ||
* | ||
* @param {any} item | ||
* @returns {boolean} | ||
*/ | ||
value: function includes(item) { | ||
return !!~this.indexOf(item); | ||
} | ||
var string = ''; | ||
/** | ||
* what is the index of item in this (if not found, defaults to -1) | ||
* | ||
* @param {any} item | ||
* @returns {number} | ||
*/ | ||
this.keys().forEach(function (key, keyIndex) { | ||
if (keyIndex !== 0) { | ||
string += separator; | ||
} | ||
}, { | ||
key: 'indexOf', | ||
value: function indexOf(item) { | ||
return ARRAY_PROTOTYPE.indexOf.call(this, item); | ||
} | ||
string += _this3[key].toString(); | ||
}); | ||
/** | ||
* joins this into string based on separator delimiting between values | ||
* | ||
* @param {string} separator | ||
* @returns {string} | ||
*/ | ||
return string; | ||
} | ||
}, { | ||
key: 'join', | ||
value: function join() { | ||
var separator = arguments.length <= 0 || arguments[0] === undefined ? ',' : arguments[0]; | ||
/** | ||
* returns keys of array (list of indices) | ||
* | ||
* @returns {array<string>} | ||
*/ | ||
return ARRAY_PROTOTYPE.join.call(this, separator); | ||
} | ||
}, { | ||
key: 'keys', | ||
value: function keys() { | ||
return OBJECT_KEYS(this); | ||
} | ||
/** | ||
* returns keys of array (list of indices) | ||
* | ||
* @returns {array<string>} | ||
*/ | ||
/** | ||
* last index of item in this | ||
* | ||
* @param {any} item | ||
* @returns {number} | ||
*/ | ||
}, { | ||
key: 'keys', | ||
value: function keys() { | ||
return OBJECT_KEYS(this); | ||
} | ||
}, { | ||
key: 'lastIndexOf', | ||
value: function lastIndexOf(item) { | ||
return ARRAY_PROTOTYPE.lastIndexOf.call(this, item); | ||
} | ||
/** | ||
* last index of item in this | ||
* | ||
* @param {any} item | ||
* @returns {number} | ||
*/ | ||
/** | ||
* iterate over this and assign values returned from calling | ||
* fn to a new CrioArray | ||
* | ||
* @param {function} fn | ||
* @param {any} thisArg | ||
* @returns {CrioArray} | ||
*/ | ||
}, { | ||
key: 'lastIndexOf', | ||
value: function lastIndexOf(item) { | ||
return ARRAY_PROTOTYPE.lastIndexOf.call(this, item); | ||
} | ||
}, { | ||
key: 'map', | ||
value: function map(fn) { | ||
var _this4 = this; | ||
/** | ||
* iterate over this and assign values returned from calling | ||
* fn to a new CrioArray | ||
* | ||
* @param {function} fn | ||
* @param {any} thisArg | ||
* @returns {CrioArray} | ||
*/ | ||
var thisArg = arguments.length <= 1 || arguments[1] === undefined ? this : arguments[1]; | ||
}, { | ||
key: 'map', | ||
value: function map(fn) { | ||
var thisArg = arguments.length <= 1 || arguments[1] === undefined ? this : arguments[1]; | ||
var mappedArray = this.keys().map(function (key) { | ||
return fn.call(thisArg, _this4[key], +key, _this4); | ||
}); | ||
var crioedArray = new CrioArray(mappedArray); | ||
var mappedArray = ARRAY_PROTOTYPE.map.call(this, fn, thisArg); | ||
return (0, _utils.returnObjectOnlyIfNew)(this, crioedArray); | ||
} | ||
return returnCorrectObject(this, mappedArray, CrioArray); | ||
} | ||
/** | ||
* shallowly merge each object into this | ||
* | ||
* @param {array<any>} objects | ||
* @returns {CrioArray} | ||
*/ | ||
/** | ||
* shallowly merge each object into this | ||
* | ||
* @param {array<any>} objects | ||
* @returns {CrioArray} | ||
*/ | ||
}, { | ||
key: 'merge', | ||
value: function merge() { | ||
var clone = isCrio(this) ? this.thaw() : this; | ||
}, { | ||
key: 'merge', | ||
value: function merge() { | ||
var clone = !(0, _utils.isCrio)(this) ? this : (0, _utils.shallowCloneArray)(this); | ||
for (var _len2 = arguments.length, objects = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { | ||
objects[_key2] = arguments[_key2]; | ||
} | ||
for (var _len4 = arguments.length, objects = Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { | ||
objects[_key4] = arguments[_key4]; | ||
} | ||
objects.forEach(function (object) { | ||
clone = clone.map(function (key, index) { | ||
return object[index] || clone[index]; | ||
}); | ||
}); | ||
(0, _utils.forEach)(objects, function (object) { | ||
clone = clone.map(function (key, keyIndex) { | ||
return object[keyIndex] || clone[keyIndex]; | ||
}); | ||
}, this); | ||
var crioedArray = new CrioArray(clone); | ||
return returnCorrectObject(this, clone, CrioArray); | ||
} | ||
return (0, _utils.returnObjectOnlyIfNew)(this, crioedArray); | ||
} | ||
/** | ||
* deeply merge all objects into location specified by keys | ||
* | ||
* @param {array<string|number>} keys | ||
* @param {array<any>} objects | ||
* @returns {CrioArray} | ||
*/ | ||
/** | ||
* deeply merge all objects into location specified by keys | ||
* | ||
* @param {array<string|number>} keys | ||
* @param {array<any>} objects | ||
* @returns {CrioArray} | ||
*/ | ||
}, { | ||
key: 'mergeIn', | ||
value: function mergeIn(keys) { | ||
if (!(0, _utils.isArray)(keys)) { | ||
throw new Error('Must provide keys as an array, such as ["foo", "bar"].'); | ||
} | ||
}, { | ||
key: 'mergeIn', | ||
value: function mergeIn(keys) { | ||
if (!(0, _utils.isArray)(keys)) { | ||
throw new Error('Must provide keys as an array, such as ["foo", "bar"].'); | ||
} | ||
for (var _len5 = arguments.length, objects = Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) { | ||
objects[_key5 - 1] = arguments[_key5]; | ||
} | ||
for (var _len3 = arguments.length, objects = Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) { | ||
objects[_key3 - 1] = arguments[_key3]; | ||
} | ||
if (!objects.length) { | ||
return this; | ||
} | ||
if (!objects.length) { | ||
return this; | ||
} | ||
return assignOnDeepMatch(this, keys, objects, true); | ||
} | ||
return assignOnDeepMatch(this, keys, objects, true); | ||
} | ||
/** | ||
* convenience function to work with mutable version of this, | ||
* in case many modifications need to be made and performance | ||
* is paramount | ||
* | ||
* @param {function} fn | ||
* @param {any} thisArg | ||
* @returns {any} | ||
*/ | ||
/** | ||
* convenience function to work with mutable version of this, | ||
* in case many modifications need to be made and performance | ||
* is paramount | ||
* | ||
* @param {function} fn | ||
* @param {any} thisArg | ||
* @returns {any} | ||
*/ | ||
}, { | ||
key: 'mutate', | ||
value: function mutate(fn) { | ||
var thisArg = arguments.length <= 1 || arguments[1] === undefined ? this : arguments[1]; | ||
}, { | ||
key: 'mutate', | ||
value: function mutate(fn) { | ||
var thisArg = arguments.length <= 1 || arguments[1] === undefined ? this : arguments[1]; | ||
var result = fn.call(thisArg, this.thaw(), this); | ||
var result = fn.call(thisArg, this.thaw(), this); | ||
var crioedValue = getRealValue(result); | ||
if ((0, _utils.hasChanged)(this, result)) { | ||
return getRealValue(result); | ||
} | ||
return (0, _utils.returnObjectOnlyIfNew)(this, crioedValue); | ||
} | ||
return this; | ||
} | ||
/** | ||
* return array with last item removed | ||
* | ||
* @returns {CrioArray} | ||
*/ | ||
/** | ||
* return array with last item removed | ||
* | ||
* @returns {CrioArray} | ||
*/ | ||
}, { | ||
key: 'pop', | ||
value: function pop() { | ||
return this.slice(0, this.length - 1); | ||
} | ||
}, { | ||
key: 'pop', | ||
value: function pop() { | ||
return this.slice(0, this.length - 1); | ||
} | ||
/** | ||
* return new CrioArray with items pushed to it | ||
* | ||
* @param {array<any>} items | ||
* @returns {CrioArray} | ||
*/ | ||
/** | ||
* return new CrioArray with items pushed to it | ||
* | ||
* @param {array<any>} items | ||
* @returns {CrioArray} | ||
*/ | ||
}, { | ||
key: 'push', | ||
value: function push() { | ||
for (var _len4 = arguments.length, items = Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { | ||
items[_key4] = arguments[_key4]; | ||
} | ||
}, { | ||
key: 'push', | ||
value: function push() { | ||
for (var _len6 = arguments.length, items = Array(_len6), _key6 = 0; _key6 < _len6; _key6++) { | ||
items[_key6] = arguments[_key6]; | ||
} | ||
return this.concat(items); | ||
} | ||
return this.concat(items); | ||
} | ||
/** | ||
* based on fn, reduce the CrioArray and return either the crio of the reduced object | ||
* or the object itself | ||
* | ||
* @param {function} fn | ||
* @param {any} object | ||
* @param {any} thisArg | ||
* @returns {any} | ||
*/ | ||
/** | ||
* based on fn, reduce the CrioArray and return either the crio of the reduced object | ||
* or the object itself | ||
* | ||
* @param {function} fn | ||
* @param {any} object | ||
* @param {any} thisArg | ||
* @returns {any} | ||
*/ | ||
}, { | ||
key: 'reduce', | ||
value: function reduce(fn, object) { | ||
var thisArg = arguments.length <= 2 || arguments[2] === undefined ? this : arguments[2]; | ||
}, { | ||
key: 'reduce', | ||
value: function reduce(fn, object) { | ||
var thisArg = arguments.length <= 2 || arguments[2] === undefined ? this : arguments[2]; | ||
var reduction = ARRAY_PROTOTYPE.reduce.call(this, fn, object, thisArg); | ||
var crioedReduction = getRealValue(reduction); | ||
var reduction = ARRAY_PROTOTYPE.reduce.call(this, fn, object, thisArg); | ||
return !crioedReduction || !crioedReduction.$$hashCode ? crioedReduction : (0, _utils.returnObjectOnlyIfNew)(this, crioedReduction); | ||
} | ||
if ((0, _utils.hasChanged)(this, reduction)) { | ||
return getRealValue(reduction); | ||
} | ||
/** | ||
* based on fn, reduceRight the CrioArray and return either the crio of the reduced object | ||
* or the object itself | ||
* | ||
* @param {function} fn | ||
* @param {any} object | ||
* @param {any} thisArg | ||
* @returns {any} | ||
*/ | ||
return this; | ||
} | ||
}, { | ||
key: 'reduceRight', | ||
value: function reduceRight(fn, object) { | ||
var thisArg = arguments.length <= 2 || arguments[2] === undefined ? this : arguments[2]; | ||
/** | ||
* based on fn, reduceRight the CrioArray and return either the crio of the reduced object | ||
* or the object itself | ||
* | ||
* @param {function} fn | ||
* @param {any} object | ||
* @param {any} thisArg | ||
* @returns {any} | ||
*/ | ||
var reduction = ARRAY_PROTOTYPE.reduceRight.call(this, fn, object, thisArg); | ||
var crioedReduction = getRealValue(reduction); | ||
}, { | ||
key: 'reduceRight', | ||
value: function reduceRight(fn, object) { | ||
var thisArg = arguments.length <= 2 || arguments[2] === undefined ? this : arguments[2]; | ||
return !crioedReduction || !crioedReduction.$$hashCode ? crioedReduction : (0, _utils.returnObjectOnlyIfNew)(this, crioedReduction); | ||
} | ||
var reduction = ARRAY_PROTOTYPE.reduceRight.call(this, fn, object, thisArg); | ||
/** | ||
* set key to value in this and return new CrioArray | ||
* | ||
* @param {number} key | ||
* @param {any} value | ||
* | ||
* @returns {CrioArray} | ||
*/ | ||
if ((0, _utils.hasChanged)(this, reduction)) { | ||
return getRealValue(reduction); | ||
} | ||
}, { | ||
key: 'set', | ||
value: function set(key, value) { | ||
var index = +key; | ||
return this; | ||
} | ||
if (index > this.length) { | ||
throw new Error('Cannot set a key for sparsed array on crio objects.'); | ||
} | ||
/** | ||
* set key to value in this and return new CrioArray | ||
* | ||
* @param {number} key | ||
* @param {any} value | ||
* | ||
* @returns {CrioArray} | ||
*/ | ||
var clone = this.thaw(); | ||
}, { | ||
key: 'set', | ||
value: function set(key, value) { | ||
var index = +key; | ||
clone[index] = value; | ||
if (index > this.length) { | ||
throw new Error('Cannot set a key for sparsed array on crio objects.'); | ||
} | ||
var crioedArray = new CrioArray(clone); | ||
var clone = (0, _utils.shallowCloneArray)(this); | ||
return (0, _utils.returnObjectOnlyIfNew)(this, crioedArray); | ||
} | ||
clone[index] = value; | ||
/** | ||
* deeply assign value to key in this and return new CrioArray | ||
* | ||
* @param {array<string|number>} keys | ||
* @param {any} value | ||
* @returns {CrioArray} | ||
*/ | ||
return returnCorrectObject(this, clone, CrioArray); | ||
} | ||
}, { | ||
key: 'setIn', | ||
value: function setIn(keys, value) { | ||
if (!(0, _utils.isArray)(keys)) { | ||
throw new Error('Must provide keys as an array, such as ["foo", "bar"].'); | ||
} | ||
/** | ||
* deeply assign value to key in this and return new CrioArray | ||
* | ||
* @param {array<string|number>} keys | ||
* @param {any} value | ||
* @returns {CrioArray} | ||
*/ | ||
return assignOnDeepMatch(this, keys, value); | ||
} | ||
}, { | ||
key: 'setIn', | ||
value: function setIn(keys, value) { | ||
if (!(0, _utils.isArray)(keys)) { | ||
throw new Error('Must provide keys as an array, such as ["foo", "bar"].'); | ||
} | ||
/** | ||
* return this with first item removed as new CrioArray | ||
* | ||
* @returns {CrioArray} | ||
*/ | ||
return assignOnDeepMatch(this, keys, value); | ||
} | ||
}, { | ||
key: 'shift', | ||
value: function shift() { | ||
return this.slice(1, this.length); | ||
} | ||
/** | ||
* return this with first item removed as new CrioArray | ||
* | ||
* @returns {CrioArray} | ||
*/ | ||
/** | ||
* return a section of this as a new CrioArray | ||
* | ||
* @param {array<number>} args | ||
* @returns {CrioArray} | ||
*/ | ||
}, { | ||
key: 'shift', | ||
value: function shift() { | ||
return this.slice(1, this.length); | ||
} | ||
}, { | ||
key: 'slice', | ||
value: function slice() { | ||
var _ARRAY_PROTOTYPE$slic; | ||
/** | ||
* return a section of this as a new CrioArray | ||
* | ||
* @param {array<number>} args | ||
* @returns {CrioArray} | ||
*/ | ||
for (var _len5 = arguments.length, args = Array(_len5), _key5 = 0; _key5 < _len5; _key5++) { | ||
args[_key5] = arguments[_key5]; | ||
} | ||
}, { | ||
key: 'slice', | ||
value: function slice() { | ||
for (var _len7 = arguments.length, args = Array(_len7), _key7 = 0; _key7 < _len7; _key7++) { | ||
args[_key7] = arguments[_key7]; | ||
} | ||
if (!args.length) { | ||
return this; | ||
} | ||
if (!args.length) { | ||
return this; | ||
} | ||
return new CrioArray((_ARRAY_PROTOTYPE$slic = ARRAY_PROTOTYPE.slice).call.apply(_ARRAY_PROTOTYPE$slic, [this].concat(args))); | ||
} | ||
}, { | ||
key: 'some', | ||
return new CrioArray(ARRAY_PROTOTYPE.slice.apply(this, args)); | ||
} | ||
}, { | ||
key: 'some', | ||
/** | ||
* does some of the returns from fn return truthy | ||
* | ||
* @param {function} fn | ||
* @param {any} thisArg | ||
* @returns {boolean} | ||
*/ | ||
value: function some(fn) { | ||
var thisArg = arguments.length <= 1 || arguments[1] === undefined ? this : arguments[1]; | ||
/** | ||
* does some of the returns from fn return truthy | ||
* | ||
* @param {function} fn | ||
* @param {any} thisArg | ||
* @returns {boolean} | ||
*/ | ||
value: function some(fn) { | ||
var thisArg = arguments.length <= 1 || arguments[1] === undefined ? this : arguments[1]; | ||
for (var index = 0, length = this.length; index < length; index++) { | ||
if (fn.call(thisArg, this[index], index, this)) { | ||
return true; | ||
} | ||
} | ||
return ARRAY_PROTOTYPE.some.call(this, fn, thisArg); | ||
} | ||
return false; | ||
} | ||
/** | ||
* sort this and return it as a new CrioArray | ||
* | ||
* @param {function} fn | ||
* @returns {CrioArray} | ||
*/ | ||
/** | ||
* sort this and return it as a new CrioArray | ||
* | ||
* @param {function} fn | ||
* @returns {CrioArray} | ||
*/ | ||
}, { | ||
key: 'sort', | ||
value: function sort(fn) { | ||
var clone = (0, _utils.shallowCloneArray)(this); | ||
var sortedArray = ARRAY_PROTOTYPE.sort.call(clone, fn); | ||
}, { | ||
key: 'sort', | ||
value: function sort(fn) { | ||
var sortedArray = this.thaw().sort(fn); | ||
var crioedArray = new CrioArray(sortedArray); | ||
return returnCorrectObject(this, sortedArray, CrioArray); | ||
} | ||
return (0, _utils.returnObjectOnlyIfNew)(this, crioedArray); | ||
} | ||
/** | ||
* based on args passed, splice this and return it as a new CrioArray | ||
* | ||
* @param {any} args | ||
* @returns {CrioArray} | ||
*/ | ||
/** | ||
* based on args passed, splice this and return it as a new CrioArray | ||
* | ||
* @param {any} args | ||
* @returns {CrioArray} | ||
*/ | ||
}, { | ||
key: 'splice', | ||
value: function splice() { | ||
var clone = (0, _utils.shallowCloneArray)(this); | ||
}, { | ||
key: 'splice', | ||
value: function splice() { | ||
var clone = this.thaw(); | ||
clone.splice.apply(clone, arguments); | ||
clone.splice.apply(clone, arguments); | ||
return returnCorrectObject(this, clone, CrioArray); | ||
} | ||
var crioedArray = new CrioArray(clone); | ||
/** | ||
* convert this back to a vanilla array | ||
* | ||
* @returns {array<any>} | ||
*/ | ||
return (0, _utils.returnObjectOnlyIfNew)(this, crioedArray); | ||
} | ||
}, { | ||
key: 'thaw', | ||
value: function thaw() { | ||
return ARRAY_PROTOTYPE.map.call(this, function (item) { | ||
return (0, _utils.isCrio)(item) ? item.thaw() : item; | ||
}); | ||
} | ||
/** | ||
* convert this back to a vanilla array | ||
* | ||
* @returns {array<any>} | ||
*/ | ||
/** | ||
* convert this to a locale-specific string | ||
* | ||
* @returns {string} | ||
*/ | ||
}, { | ||
key: 'thaw', | ||
value: function thaw() { | ||
return ARRAY_PROTOTYPE.map.call(this, function (item) { | ||
return isCrio(item) ? item.thaw() : item; | ||
}); | ||
} | ||
}, { | ||
key: 'toLocaleString', | ||
value: function toLocaleString() { | ||
return (0, _utils.stringify)(this); | ||
} | ||
/** | ||
* convert this to a locale-specific string | ||
* | ||
* @returns {string} | ||
*/ | ||
/** | ||
* convert this to a string showing key: value pair combos | ||
* | ||
* @returns {string} | ||
*/ | ||
}, { | ||
key: 'toLocaleString', | ||
value: function toLocaleString() { | ||
return this.toString(); | ||
} | ||
}, { | ||
key: 'toString', | ||
value: function toString() { | ||
return (0, _utils.stringify)(this); | ||
} | ||
/** | ||
* convert this to a string showing key: value pair combos | ||
* | ||
* @returns {string} | ||
*/ | ||
/** | ||
* add items to the beginning of this and return it as a new CrioArray | ||
* | ||
* @param {array<any>} items | ||
* @returns {CrioArray} | ||
*/ | ||
}, { | ||
key: 'toString', | ||
value: function toString() { | ||
var _this5 = this; | ||
}, { | ||
key: 'unshift', | ||
value: function unshift() { | ||
for (var _len8 = arguments.length, items = Array(_len8), _key8 = 0; _key8 < _len8; _key8++) { | ||
items[_key8] = arguments[_key8]; | ||
} | ||
var string = 'CrioArray {'; | ||
if (!items.length) { | ||
return this; | ||
} | ||
this.keys().forEach(function (key, keyIndex) { | ||
if (keyIndex !== 0) { | ||
string += ', '; | ||
} | ||
return new CrioArray([].concat(items, _toConsumableArray(this))); | ||
} | ||
var value = _this5[key]; | ||
var cleanValue = isCrio(value) ? value.toString() : '"' + value + '"'; | ||
/** | ||
* get the iterable array of values for this | ||
* | ||
* @returns {array<any>} | ||
*/ | ||
string += key + ': ' + cleanValue; | ||
}); | ||
}, { | ||
key: 'values', | ||
value: function values() { | ||
return OBJECT_VALUES(this); | ||
} | ||
string += '}'; | ||
/** | ||
* make CrioArray into an iterable | ||
* | ||
* @returns {{next: (function(): {value: any, done: boolean})}} | ||
*/ | ||
return string; | ||
} | ||
}, { | ||
key: Symbol.iterator, | ||
value: function value() { | ||
var _this2 = this; | ||
/** | ||
* add items to the beginning of this and return it as a new CrioArray | ||
* | ||
* @param {array<any>} items | ||
* @returns {CrioArray} | ||
*/ | ||
var index = 0; | ||
}, { | ||
key: 'unshift', | ||
value: function unshift() { | ||
for (var _len6 = arguments.length, items = Array(_len6), _key6 = 0; _key6 < _len6; _key6++) { | ||
items[_key6] = arguments[_key6]; | ||
} | ||
return { | ||
next: function next() { | ||
var value = _this2[index]; | ||
var done = index >= _this2.length; | ||
if (!items.length) { | ||
return this; | ||
} | ||
index++; | ||
return new CrioArray([].concat(items, _toConsumableArray(this))); | ||
return { | ||
value: value, | ||
done: done | ||
}; | ||
} | ||
}; | ||
} | ||
}, { | ||
key: '$$type', | ||
get: function get() { | ||
return CRIO_ARRAY_TYPE; | ||
} | ||
}]); | ||
/** | ||
* get the iterable array of values for this | ||
* | ||
* @returns {array<any>} | ||
*/ | ||
return CrioArray; | ||
}(); | ||
}, { | ||
key: 'values', | ||
value: function values() { | ||
return OBJECT_VALUES(this); | ||
} | ||
var CrioObject = function () { | ||
function CrioObject(object) { | ||
var _this3 = this; | ||
/** | ||
* make CrioArray into an iterable | ||
* | ||
* @returns {{next: (function(): {value: any, done: boolean})}} | ||
*/ | ||
_classCallCheck(this, CrioObject); | ||
}, { | ||
key: Symbol.iterator, | ||
value: function value() { | ||
var _this6 = this; | ||
if ((0, _utils.isCrio)(object)) { | ||
return object; | ||
} | ||
var index = 0; | ||
var keys = OBJECT_OWN_PROPERTY_NAMES(object); | ||
return { | ||
next: function next() { | ||
var value = _this6[index]; | ||
var done = index >= _this6.length; | ||
var length = 0; | ||
index++; | ||
(0, _utils.forEach)(keys, function (key) { | ||
if (!~NATIVE_KEYS.indexOf(key)) { | ||
_this3[key] = getRealValue(object[key]); | ||
return { | ||
value: value, | ||
done: done | ||
}; | ||
} | ||
}; | ||
} | ||
}, { | ||
key: '$$hashCode', | ||
get: function get() { | ||
return (0, _utils.hash)(this.toString()); | ||
} | ||
length++; | ||
} | ||
}, this); | ||
/** | ||
* return type of CrioArray | ||
* | ||
* @return {string} | ||
*/ | ||
var hashCode = (0, _utils.hash)(object); | ||
}, { | ||
key: '$$type', | ||
get: function get() { | ||
return 'CrioArray'; | ||
} | ||
}]); | ||
(0, _utils.setNonEnumerable)(this, '$$hashCode', hashCode); | ||
(0, _utils.setNonEnumerable)(this, 'length', length); | ||
return CrioArray; | ||
}(); | ||
return OBJECT_FREEZE(this); | ||
} | ||
var CrioObject = function () { | ||
function CrioObject(object) { | ||
_classCallCheck(this, CrioObject); | ||
/** | ||
* return type of CrioObject | ||
* | ||
* @return {string} | ||
*/ | ||
if (isCrio(object)) { | ||
return object; | ||
} | ||
var keys = OBJECT_OWN_PROPERTY_NAMES(object).filter(function (key) { | ||
return NATIVE_KEYS.indexOf(key) === -1; | ||
}); | ||
var length = keys.length; | ||
_createClass(CrioObject, [{ | ||
key: 'entries', | ||
for (var index = 0; index < length; index++) { | ||
var key = keys[index]; | ||
var value = getRealValue(object[key]); | ||
(0, _utils.setReadOnly)(this, key, value, object.propertyIsEnumerable(key)); | ||
} | ||
return OBJECT_FREEZE(this); | ||
/** | ||
* return iterable array of keys in this | ||
* | ||
* @returns {array<string>} | ||
*/ | ||
value: function entries() { | ||
return OBJECT_ENTRIES(this); | ||
} | ||
/** | ||
* return unique hash of this values | ||
* is the object passed equal in value to this | ||
* | ||
* @return {number} | ||
* @param {any} object | ||
* @returns {boolean} | ||
*/ | ||
}, { | ||
key: 'equals', | ||
value: function equals(object) { | ||
if (!(0, _utils.isCrio)(object)) { | ||
return false; | ||
} | ||
_createClass(CrioObject, [{ | ||
key: 'entries', | ||
return this.$$hashCode === object.$$hashCode; | ||
} | ||
/** | ||
* return value at key in this | ||
* | ||
* @param {string} key | ||
* @returns {any} | ||
*/ | ||
/** | ||
* return iterable array of keys in this | ||
* | ||
* @returns {array<string>} | ||
*/ | ||
value: function entries() { | ||
return OBJECT_ENTRIES(this); | ||
} | ||
}, { | ||
key: 'get', | ||
value: function get(key) { | ||
return this[key.toString()]; | ||
} | ||
/** | ||
* is the object passed equal in value to this | ||
* | ||
* @param {any} object | ||
* @returns {boolean} | ||
*/ | ||
/** | ||
* return value at nested point based on keys in this | ||
* | ||
* @param {array<string|number>} keys | ||
* @return {any} | ||
*/ | ||
}, { | ||
key: 'equals', | ||
value: function equals(object) { | ||
if (!isCrio(object)) { | ||
return false; | ||
} | ||
}, { | ||
key: 'getIn', | ||
value: function getIn(keys) { | ||
if (!(0, _utils.isArray)(keys)) { | ||
throw new Error('Must provide keys as an array, such as ["foo", "bar"].'); | ||
} | ||
return this.$$hashCode === object.$$hashCode; | ||
} | ||
var length = keys.length; | ||
var lastIndex = length - 1; | ||
/** | ||
* return value at key in this | ||
* | ||
* @param {string} key | ||
* @returns {any} | ||
*/ | ||
var currentObject = this, | ||
index = -1, | ||
key = void 0; | ||
}, { | ||
key: 'get', | ||
value: function get(key) { | ||
return this[key.toString()]; | ||
} | ||
while (++index < length) { | ||
key = keys[index]; | ||
/** | ||
* return value at nested point based on keys in this | ||
* | ||
* @param {array<string|number>} keys | ||
* @return {any} | ||
*/ | ||
}, { | ||
key: 'getIn', | ||
value: function getIn(keys) { | ||
if (!(0, _utils.isArray)(keys)) { | ||
throw new Error('Must provide keys as an array, such as ["foo", "bar"].'); | ||
} | ||
var length = keys.length; | ||
var lastIndex = length - 1; | ||
var currentObject = this; | ||
for (var index = 0; index < length; index++) { | ||
var key = keys[index]; | ||
if ((0, _utils.isUndefined)(currentObject[key]) || index === lastIndex) { | ||
return currentObject[key]; | ||
} | ||
currentObject = currentObject[key]; | ||
} | ||
if ((0, _utils.isUndefined)(currentObject[key]) || index === lastIndex) { | ||
return currentObject[key]; | ||
} | ||
}, { | ||
key: 'hasOwnProperty', | ||
currentObject = currentObject[key]; | ||
} | ||
} | ||
}, { | ||
key: 'hasOwnProperty', | ||
/** | ||
* return if this has the property passed | ||
* | ||
* @param {string} property | ||
* @returns {boolean} | ||
*/ | ||
value: function hasOwnProperty(property) { | ||
return OBJECT_PROTOTYPE.hasOwnProperty.call(this, property); | ||
} | ||
/** | ||
* return if this has the prototype of object passed | ||
* | ||
* @param {any} object | ||
* @returns {boolean} | ||
*/ | ||
/** | ||
* return if this has the property passed | ||
* | ||
* @param {string} property | ||
* @returns {boolean} | ||
*/ | ||
value: function hasOwnProperty(property) { | ||
return OBJECT_PROTOTYPE.hasOwnProperty.call(this, property); | ||
} | ||
}, { | ||
key: 'isPrototypeOf', | ||
value: function isPrototypeOf(object) { | ||
return OBJECT_PROTOTYPE.isPrototypeOf.call(this, object); | ||
} | ||
/** | ||
* return if this has the prototype of object passed | ||
* | ||
* @param {any} object | ||
* @returns {boolean} | ||
*/ | ||
/** | ||
* return iterable of keys in this | ||
* | ||
* @returns {array<string>} | ||
*/ | ||
}, { | ||
key: 'isPrototypeOf', | ||
value: function isPrototypeOf(object) { | ||
return OBJECT_PROTOTYPE.isPrototypeOf.call(this, object); | ||
} | ||
}, { | ||
key: 'keys', | ||
value: function keys() { | ||
return OBJECT_KEYS(this); | ||
} | ||
/** | ||
* return iterable of keys in this | ||
* | ||
* @returns {array<string>} | ||
*/ | ||
/** | ||
* shallowly merge all objects into this and return as new CrioObject | ||
* | ||
* @param {array<any>} objects | ||
* @returns {CrioObject} | ||
*/ | ||
}, { | ||
key: 'keys', | ||
value: function keys() { | ||
return OBJECT_KEYS(this); | ||
} | ||
}, { | ||
key: 'merge', | ||
value: function merge() { | ||
var clone = isCrio(this) ? this.thaw() : this; | ||
/** | ||
* shallowly merge all objects into this and return as new CrioObject | ||
* | ||
* @param {array<any>} objects | ||
* @returns {CrioObject} | ||
*/ | ||
for (var _len7 = arguments.length, objects = Array(_len7), _key7 = 0; _key7 < _len7; _key7++) { | ||
objects[_key7] = arguments[_key7]; | ||
} | ||
}, { | ||
key: 'merge', | ||
value: function merge() { | ||
var clone = !(0, _utils.isCrio)(this) ? this : _extends({}, this); | ||
objects.forEach(function (object) { | ||
Object.assign(clone, object); | ||
}); | ||
for (var _len9 = arguments.length, objects = Array(_len9), _key9 = 0; _key9 < _len9; _key9++) { | ||
objects[_key9] = arguments[_key9]; | ||
} | ||
var crioedObject = new CrioObject(clone); | ||
(0, _utils.forEach)(objects, function (object) { | ||
Object.assign(clone, object); | ||
}, clone); | ||
return (0, _utils.returnObjectOnlyIfNew)(this, crioedObject); | ||
} | ||
return returnCorrectObject(this, clone, CrioObject); | ||
} | ||
/** | ||
* deeply merge all objects into this at key value determined by keys, | ||
* and return as a new CrioObject | ||
* | ||
* @param {array<string|number>} keys | ||
* @param {array<any>} objects | ||
* @returns {CrioObject} | ||
*/ | ||
/** | ||
* deeply merge all objects into this at key value determined by keys, | ||
* and return as a new CrioObject | ||
* | ||
* @param {array<string|number>} keys | ||
* @param {array<any>} objects | ||
* @returns {CrioObject} | ||
*/ | ||
}, { | ||
key: 'mergeIn', | ||
value: function mergeIn(keys) { | ||
if (!(0, _utils.isArray)(keys)) { | ||
throw new Error('Must provide keys as an array, such as ["foo", "bar"].'); | ||
} | ||
}, { | ||
key: 'mergeIn', | ||
value: function mergeIn(keys) { | ||
if (!(0, _utils.isArray)(keys)) { | ||
throw new Error('Must provide keys as an array, such as ["foo", "bar"].'); | ||
} | ||
for (var _len8 = arguments.length, objects = Array(_len8 > 1 ? _len8 - 1 : 0), _key8 = 1; _key8 < _len8; _key8++) { | ||
objects[_key8 - 1] = arguments[_key8]; | ||
} | ||
for (var _len10 = arguments.length, objects = Array(_len10 > 1 ? _len10 - 1 : 0), _key10 = 1; _key10 < _len10; _key10++) { | ||
objects[_key10 - 1] = arguments[_key10]; | ||
} | ||
if (!objects.length) { | ||
return this; | ||
} | ||
if (!objects.length) { | ||
return this; | ||
} | ||
return assignOnDeepMatch(this, keys, objects, true); | ||
} | ||
return assignOnDeepMatch(this, keys, objects, true); | ||
} | ||
/** | ||
* convenience function to work with mutable version of this, | ||
* in case many modifications need to be made and performance | ||
* is paramount | ||
* | ||
* @param {function} fn | ||
* @param {any} thisArg | ||
* @returns {any} | ||
*/ | ||
/** | ||
* convenience function to work with mutable version of this, | ||
* in case many modifications need to be made and performance | ||
* is paramount | ||
* | ||
* @param {function} fn | ||
* @param {any} thisArg | ||
* @returns {any} | ||
*/ | ||
}, { | ||
key: 'mutate', | ||
value: function mutate(fn) { | ||
var thisArg = arguments.length <= 1 || arguments[1] === undefined ? this : arguments[1]; | ||
}, { | ||
key: 'mutate', | ||
value: function mutate(fn) { | ||
var thisArg = arguments.length <= 1 || arguments[1] === undefined ? this : arguments[1]; | ||
var result = fn.call(thisArg, this.thaw(), this); | ||
var crioedValue = getRealValue(result); | ||
var result = fn.call(thisArg, this.thaw(), this); | ||
return (0, _utils.returnObjectOnlyIfNew)(this, crioedValue); | ||
} | ||
if ((0, _utils.hasChanged)(this, result)) { | ||
return getRealValue(result); | ||
} | ||
/** | ||
* determine if property passed is enumerable in this | ||
* | ||
* @param {string} property | ||
* @returns {boolean} | ||
*/ | ||
return this; | ||
} | ||
}, { | ||
key: 'propertyIsEnumerable', | ||
value: function propertyIsEnumerable(property) { | ||
return OBJECT_PROTOTYPE.propertyIsEnumerable.call(this, property); | ||
} | ||
/** | ||
* determine if property passed is enumerable in this | ||
* | ||
* @param {string} property | ||
* @returns {boolean} | ||
*/ | ||
/** | ||
* set value at key in this | ||
* | ||
* @param {string} key | ||
* @param {any} value | ||
* @returns {CrioObject} | ||
*/ | ||
}, { | ||
key: 'propertyIsEnumerable', | ||
value: function propertyIsEnumerable(property) { | ||
return OBJECT_PROTOTYPE.propertyIsEnumerable.call(this, property); | ||
} | ||
}, { | ||
key: 'set', | ||
value: function set(key, value) { | ||
var clone = this.thaw(); | ||
/** | ||
* set value at key in this | ||
* | ||
* @param {string} key | ||
* @param {any} value | ||
* @returns {CrioObject} | ||
*/ | ||
clone[key] = value; | ||
}, { | ||
key: 'set', | ||
value: function set(key, value) { | ||
var clone = _extends({}, this); | ||
var crioedObject = new CrioObject(clone); | ||
clone[key] = value; | ||
return (0, _utils.returnObjectOnlyIfNew)(this, crioedObject); | ||
} | ||
return returnCorrectObject(this, clone, CrioObject); | ||
} | ||
/** | ||
* deeply set value at location determined by keys in this | ||
* | ||
* @param {array<string|number>} keys | ||
* @param {any} value | ||
* @returns {CrioObject} | ||
*/ | ||
/** | ||
* deeply set value at location determined by keys in this | ||
* | ||
* @param {array<string|number>} keys | ||
* @param {any} value | ||
* @returns {CrioObject} | ||
*/ | ||
}, { | ||
key: 'setIn', | ||
value: function setIn(keys, value) { | ||
if (!(0, _utils.isArray)(keys)) { | ||
throw new Error('Must provide keys as an array, such as ["foo", "bar"].'); | ||
} | ||
}, { | ||
key: 'setIn', | ||
value: function setIn(keys, value) { | ||
if (!(0, _utils.isArray)(keys)) { | ||
throw new Error('Must provide keys as an array, such as ["foo", "bar"].'); | ||
} | ||
return assignOnDeepMatch(this, keys, value); | ||
} | ||
return assignOnDeepMatch(this, keys, value); | ||
} | ||
/** | ||
* convert this back to a vanilla array | ||
* | ||
* @returns {array<any>} | ||
*/ | ||
/** | ||
* convert this back to a vanilla array | ||
* | ||
* @returns {array<any>} | ||
*/ | ||
}, { | ||
key: 'thaw', | ||
value: function thaw() { | ||
var _this7 = this; | ||
}, { | ||
key: 'thaw', | ||
value: function thaw() { | ||
var _this4 = this; | ||
return OBJECT_OWN_PROPERTY_NAMES(this).reduce(function (object, key) { | ||
if (NATIVE_KEYS.indexOf(key) === -1) { | ||
var value = _this7[key]; | ||
var cleanValue = isCrio(value) ? value.thaw() : value; | ||
var propertyNames = OBJECT_OWN_PROPERTY_NAMES(this); | ||
(0, _utils.setStandard)(object, key, cleanValue, _this7.propertyIsEnumerable(key)); | ||
} | ||
var object = {}; | ||
return object; | ||
}, {}); | ||
} | ||
(0, _utils.forEach)(propertyNames, function (key) { | ||
if (NATIVE_KEYS.indexOf(key) === -1) { | ||
var value = _this4[key]; | ||
var cleanValue = (0, _utils.isCrio)(value) ? value.thaw() : value; | ||
/** | ||
* convert this to a locale-specific string | ||
* | ||
* @returns {string} | ||
*/ | ||
}, { | ||
key: 'toLocaleString', | ||
value: function toLocaleString() { | ||
return this.toString(); | ||
(0, _utils.setStandard)(object, key, cleanValue, _this4.propertyIsEnumerable(key)); | ||
} | ||
}, this); | ||
/** | ||
* convert this to a string showing key: value pair combos | ||
* | ||
* @returns {string} | ||
*/ | ||
return object; | ||
} | ||
}, { | ||
key: 'toString', | ||
value: function toString() { | ||
var _this8 = this; | ||
/** | ||
* convert this to a locale-specific string | ||
* | ||
* @returns {string} | ||
*/ | ||
var startString = 'CrioObject {'; | ||
}, { | ||
key: 'toLocaleString', | ||
value: function toLocaleString() { | ||
return (0, _utils.stringify)(this); | ||
} | ||
var string = startString; | ||
/** | ||
* convert this to a string showing key: value pair combos | ||
* | ||
* @returns {string} | ||
*/ | ||
OBJECT_OWN_PROPERTY_NAMES(this).forEach(function (key) { | ||
if (NATIVE_KEYS.indexOf(key) === -1) { | ||
if (string !== startString) { | ||
string += ', '; | ||
} | ||
}, { | ||
key: 'toString', | ||
value: function toString() { | ||
return (0, _utils.stringify)(this); | ||
} | ||
var value = _this8[key]; | ||
var cleanValue = isCrio(value) ? value.toString() : '"' + value + '"'; | ||
/** | ||
* get the valueOf for this | ||
* | ||
* @return {any} | ||
*/ | ||
string += '"' + key + '": ' + cleanValue; | ||
} | ||
}); | ||
}, { | ||
key: 'valueOf', | ||
value: function valueOf() { | ||
return OBJECT_PROTOTYPE.valueOf.call(this); | ||
} | ||
string += '}'; | ||
/** | ||
* get the iterable array of values for this | ||
* | ||
* @returns {array<any>} | ||
*/ | ||
return string; | ||
} | ||
}, { | ||
key: 'values', | ||
value: function values() { | ||
return OBJECT_VALUES(this); | ||
} | ||
/** | ||
* get the valueOf for this | ||
* | ||
* @return {any} | ||
*/ | ||
/** | ||
* make CrioObject into an iterable | ||
* | ||
* @returns {{next: (function(): {value: any, done: boolean})}} | ||
*/ | ||
}, { | ||
key: 'valueOf', | ||
value: function valueOf() { | ||
return OBJECT_PROTOTYPE.valueOf.call(this); | ||
} | ||
}, { | ||
key: Symbol.iterator, | ||
value: function value() { | ||
var _this5 = this; | ||
/** | ||
* get the iterable array of values for this | ||
* | ||
* @returns {array<any>} | ||
*/ | ||
var keys = OBJECT_KEYS(this); | ||
}, { | ||
key: 'values', | ||
value: function values() { | ||
return OBJECT_VALUES(this); | ||
} | ||
var index = 0; | ||
/** | ||
* make CrioObject into an iterable | ||
* | ||
* @returns {{next: (function(): {value: any, done: boolean})}} | ||
*/ | ||
return { | ||
next: function next() { | ||
var key = keys[index]; | ||
var value = _this5[key]; | ||
var done = index >= _this5.length; | ||
}, { | ||
key: Symbol.iterator, | ||
value: function value() { | ||
var _this9 = this; | ||
index++; | ||
var keys = OBJECT_KEYS(this); | ||
var index = 0; | ||
return { | ||
next: function next() { | ||
var key = keys[index]; | ||
var value = _this9[key]; | ||
var done = index >= _this9.length; | ||
index++; | ||
return { | ||
value: value, | ||
done: done | ||
}; | ||
} | ||
}; | ||
return { | ||
value: value, | ||
done: done | ||
}; | ||
} | ||
}, { | ||
key: '$$hashCode', | ||
get: function get() { | ||
return (0, _utils.hash)(this.toString()); | ||
} | ||
}; | ||
} | ||
}, { | ||
key: '$$type', | ||
get: function get() { | ||
return CRIO_OBJECT_TYPE; | ||
} | ||
}]); | ||
/** | ||
* return type of CrioObject | ||
* | ||
* @return {string} | ||
*/ | ||
}, { | ||
key: '$$type', | ||
get: function get() { | ||
return 'CrioObject'; | ||
} | ||
/** | ||
* return number of keys in object (getter here because it will show up in console, | ||
* whereas for CrioArray it is an expected property and is appropriately hidden) | ||
* | ||
* @return {number} | ||
*/ | ||
}, { | ||
key: 'length', | ||
get: function get() { | ||
var keys = OBJECT_OWN_PROPERTY_NAMES(this).filter(function (key) { | ||
return NATIVE_KEYS.indexOf(key) === -1; | ||
}); | ||
return keys.length; | ||
} | ||
}]); | ||
return CrioObject; | ||
return CrioObject; | ||
}(); | ||
@@ -1349,11 +1262,11 @@ | ||
var crio = function crio(object) { | ||
if ((0, _utils.isArray)(object)) { | ||
return new CrioArray(object); | ||
} | ||
if ((0, _utils.isArray)(object)) { | ||
return new CrioArray(object); | ||
} | ||
if ((0, _utils.isObject)(object)) { | ||
return new CrioObject(object); | ||
} | ||
if ((0, _utils.isObject)(object)) { | ||
return new CrioObject(object); | ||
} | ||
return object; | ||
return object; | ||
}; | ||
@@ -1363,5 +1276,5 @@ | ||
exports.getRealValue = getRealValue; | ||
exports.isCrio = isCrio; | ||
exports.isCrio = _utils.isCrio; | ||
exports.CrioArray = CrioArray; | ||
exports.CrioObject = CrioObject; | ||
exports.default = crio; |
211
lib/utils.js
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
value: true | ||
}); | ||
exports.setStandard = exports.setReadOnly = exports.setNonEnumerable = exports.returnObjectOnlyIfNew = exports.isUndefined = exports.isObject = exports.isArray = exports.hash = undefined; | ||
exports.stringify = exports.shallowCloneArray = exports.setStandard = exports.setNonEnumerable = exports.returnObjectOnlyIfNew = exports.isUndefined = exports.isObject = exports.isCrio = exports.isArray = exports.hash = exports.hasChanged = exports.forEach = undefined; | ||
var _murmurhash3js = require('murmurhash3js'); | ||
var _cryptoJs = require('crypto-js'); | ||
var _murmurhash3js2 = _interopRequireDefault(_murmurhash3js); | ||
var _cryptoJs2 = _interopRequireDefault(_cryptoJs); | ||
var _stringifier = require('stringifier'); | ||
var _stringifier2 = _interopRequireDefault(_stringifier); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var HASH_SEED = 13; | ||
var SHA1 = _cryptoJs2.default.SHA1; | ||
var STRINGIFIER_OPTIONS = { | ||
maxDepth: 25, | ||
indent: ' ' | ||
}; | ||
var stringify = (0, _stringifier2.default)(STRINGIFIER_OPTIONS); | ||
var ARRAY_TYPE = '[object Array]'; | ||
var OBJECT_TYPE = '[object Object]'; | ||
/** | ||
* apply Object's prototypical toString to object | ||
* convert object to readable string | ||
* | ||
* @param {any} object | ||
* @return {string} | ||
*/ | ||
var buildStringForHash = function buildStringForHash(object) { | ||
if (!isArray(object) && !isObject(object)) { | ||
return object.toString(); | ||
} | ||
var keys = Object.keys(object); | ||
var string = '', | ||
length = keys.length, | ||
index = -1, | ||
elements = void 0, | ||
key = void 0, | ||
value = void 0, | ||
valueLength = void 0, | ||
valueIndex = void 0; | ||
while (++index < length) { | ||
key = keys[index]; | ||
value = object[key]; | ||
if (isObject(value)) { | ||
string += '|' + key + ':' + buildStringForHash(value) + '|'; | ||
} else if (isArray(value)) { | ||
elements = []; | ||
valueLength = value.length; | ||
valueIndex = -1; | ||
while (++valueIndex < valueLength) { | ||
elements.push(buildStringForHash(value[valueIndex])); | ||
} | ||
if (elements.length > 0) { | ||
string += key + ':[' + elements.join(',') + ']'; | ||
} | ||
} else { | ||
string += '|' + key + ':' + value + '|'; | ||
} | ||
} | ||
return string; | ||
}; | ||
/** | ||
* utility function (faster than native forEach) | ||
* | ||
* @param {array<any>} array | ||
* @param {function} fn | ||
* @param {any} thisArg | ||
*/ | ||
var forEach = function forEach(array, fn, thisArg) { | ||
var length = array.length; | ||
var index = -1; | ||
while (++index < length) { | ||
fn.call(thisArg, array[index], index, array); | ||
} | ||
}; | ||
/** | ||
* based on object passed, get its type in lowercase string format | ||
* | ||
* @param {any} object | ||
@@ -23,16 +102,31 @@ * @return {string} | ||
var toString = function toString(object) { | ||
return Object.prototype.toString.call(object); | ||
return Object.prototype.toString.call(object); | ||
}; | ||
/** | ||
* hash string using murmur3 hashing algorithm | ||
* determine if the values for newObject match those for the crioObject | ||
* | ||
* @param {string} string | ||
* @returns {string} | ||
* @param {CrioArray|CrioObject} crioObject | ||
* @param {any} newObject | ||
* @returns {boolean} | ||
*/ | ||
var hash = function hash(string) { | ||
return _murmurhash3js2.default.x86.hash32(string, HASH_SEED); | ||
var hasChanged = function hasChanged(crioObject, newObject) { | ||
var hashCode = hash(newObject); | ||
return crioObject.$$hashCode !== hashCode; | ||
}; | ||
/** | ||
* convert object into unique hash value | ||
* | ||
* @param {CrioArray|CrioObject|array|object} object | ||
* @return {string} | ||
*/ | ||
var hash = function hash(object) { | ||
var string = buildStringForHash(object); | ||
return SHA1(string).toString(); | ||
}; | ||
/** | ||
* determine if object is array | ||
@@ -44,6 +138,16 @@ * | ||
var isArray = function isArray(object) { | ||
return toString(object) === '[object Array]' || !!(object && object.$$type === 'CrioArray'); | ||
return toString(object) === ARRAY_TYPE || !!(object && object.$$type === 'CrioArray'); | ||
}; | ||
/** | ||
* is object a CrioArray or CrioObject | ||
* | ||
* @param {any} object | ||
* @returns {boolean} | ||
*/ | ||
var isCrio = function isCrio(object) { | ||
return !!(object && object.$$type); | ||
}; | ||
/** | ||
* determine if object is object | ||
@@ -55,3 +159,3 @@ * | ||
var isObject = function isObject(object) { | ||
return toString(object) === '[object Object]' && !!object && object.$$type !== 'CrioArray' || !!(object && object.$$type === 'CrioObject'); | ||
return toString(object) === OBJECT_TYPE && !!object && object.$$type !== 'CrioArray' || !!(object && object.$$type === 'CrioObject'); | ||
}; | ||
@@ -61,3 +165,3 @@ | ||
* determine if object is undefined | ||
* | ||
* | ||
* @param {any} object | ||
@@ -67,3 +171,3 @@ * @return {boolean} | ||
var isUndefined = function isUndefined(object) { | ||
return object === void 0; | ||
return object === void 0; | ||
}; | ||
@@ -79,30 +183,30 @@ | ||
var returnObjectOnlyIfNew = function returnObjectOnlyIfNew() { | ||
var currentObject = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; | ||
var newObject = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; | ||
var currentObject = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; | ||
var newObject = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; | ||
if (currentObject.$$hashCode !== newObject.$$hashCode) { | ||
return newObject; | ||
} | ||
if (currentObject.$$hashCode !== newObject.$$hashCode) { | ||
return newObject; | ||
} | ||
return currentObject; | ||
return currentObject; | ||
}; | ||
/** | ||
* set property in object to be non-enumerable | ||
* return a new array from the existing CrioArray | ||
* | ||
* @param {object} object | ||
* @param {string} property | ||
* @param {any} value | ||
* @param {CrioArray} crioArray | ||
* @returns {array<any>} | ||
*/ | ||
var setNonEnumerable = function setNonEnumerable(object, property, value) { | ||
Object.defineProperty(object, property, { | ||
configurable: false, | ||
enumerable: false, | ||
value: value, | ||
writable: false | ||
}); | ||
var shallowCloneArray = function shallowCloneArray(crioArray) { | ||
var array = []; | ||
forEach(crioArray, function (item, index) { | ||
array[index] = item; | ||
}, crioArray); | ||
return array; | ||
}; | ||
/** | ||
* set property in object to be readonly (not configurable or writable) | ||
* set property in object to be non-enumerable | ||
* | ||
@@ -112,13 +216,10 @@ * @param {object} object | ||
* @param {any} value | ||
* @param {boolean} enumerable=true | ||
*/ | ||
var setReadOnly = function setReadOnly(object, property, value) { | ||
var enumerable = arguments.length <= 3 || arguments[3] === undefined ? true : arguments[3]; | ||
Object.defineProperty(object, property, { | ||
configurable: false, | ||
enumerable: enumerable, | ||
value: value, | ||
writable: false | ||
}); | ||
var setNonEnumerable = function setNonEnumerable(object, property, value) { | ||
Object.defineProperty(object, property, { | ||
configurable: false, | ||
enumerable: false, | ||
value: value, | ||
writable: false | ||
}); | ||
}; | ||
@@ -135,14 +236,17 @@ | ||
var setStandard = function setStandard(object, property, value) { | ||
var enumerable = arguments.length <= 3 || arguments[3] === undefined ? true : arguments[3]; | ||
var enumerable = arguments.length <= 3 || arguments[3] === undefined ? true : arguments[3]; | ||
Object.defineProperty(object, property, { | ||
configurable: true, | ||
enumerable: enumerable, | ||
value: value, | ||
writable: true | ||
}); | ||
Object.defineProperty(object, property, { | ||
configurable: true, | ||
enumerable: enumerable, | ||
value: value, | ||
writable: true | ||
}); | ||
}; | ||
exports.forEach = forEach; | ||
exports.hasChanged = hasChanged; | ||
exports.hash = hash; | ||
exports.isArray = isArray; | ||
exports.isCrio = isCrio; | ||
exports.isObject = isObject; | ||
@@ -152,3 +256,4 @@ exports.isUndefined = isUndefined; | ||
exports.setNonEnumerable = setNonEnumerable; | ||
exports.setReadOnly = setReadOnly; | ||
exports.setStandard = setStandard; | ||
exports.setStandard = setStandard; | ||
exports.shallowCloneArray = shallowCloneArray; | ||
exports.stringify = stringify; |
@@ -20,3 +20,4 @@ { | ||
"core-js": "^2.4.0", | ||
"murmurhash3js": "^3.0.1" | ||
"crypto-js": "^3.1.6", | ||
"stringifier": "^1.3.0" | ||
}, | ||
@@ -33,3 +34,3 @@ "description": "Immutable JS ojbects with a natural API", | ||
"babel-preset-es2015": "6.9.0", | ||
"babel-preset-react": "6.5.0", | ||
"babel-preset-react": "6.11.1", | ||
"babel-preset-stage-0": "6.5.0", | ||
@@ -69,3 +70,3 @@ "babel-register": "^6.9.0", | ||
}, | ||
"version": "2.0.2" | ||
"version": "2.1.0" | ||
} |
@@ -39,3 +39,3 @@ # crio | ||
``` | ||
This is true of strings, numbers, undefined, and null, and is an expected behavior. The same idea, however, is not true for complex objects in JavaScfript. For example: | ||
This is true of strings, numbers, undefined, and null, and is an expected behavior. The same idea, however, is not true for complex objects in JavaScript. For example: | ||
```javascript | ||
@@ -42,0 +42,0 @@ const foo = ['foo']; |
Sorry, the diff of this file is too big to display
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
2164
267133
3
+ Addedcrypto-js@^3.1.6
+ Addedstringifier@^1.3.0
+ Addedarray-buffer-byte-length@1.0.1(transitive)
+ Addedarraybuffer.prototype.slice@1.0.3(transitive)
+ Addedavailable-typed-arrays@1.0.7(transitive)
+ Addedcall-bind@1.0.8(transitive)
+ Addedcall-bind-apply-helpers@1.0.1(transitive)
+ Addedcall-bound@1.0.2(transitive)
+ Addedcrypto-js@3.3.0(transitive)
+ Addeddata-view-buffer@1.0.1(transitive)
+ Addeddata-view-byte-length@1.0.1(transitive)
+ Addeddata-view-byte-offset@1.0.0(transitive)
+ Addeddefine-data-property@1.1.4(transitive)
+ Addeddefine-properties@1.2.1(transitive)
+ Addeddunder-proto@1.0.0(transitive)
+ Addedes-abstract@1.23.5(transitive)
+ Addedes-define-property@1.0.1(transitive)
+ Addedes-errors@1.3.0(transitive)
+ Addedes-object-atoms@1.0.0(transitive)
+ Addedes-set-tostringtag@2.0.3(transitive)
+ Addedes-to-primitive@1.3.0(transitive)
+ Addedfor-each@0.3.3(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedfunction.prototype.name@1.1.6(transitive)
+ Addedfunctions-have-names@1.2.3(transitive)
+ Addedget-intrinsic@1.2.6(transitive)
+ Addedget-symbol-description@1.0.2(transitive)
+ Addedglobalthis@1.0.4(transitive)
+ Addedgopd@1.2.0(transitive)
+ Addedhas-bigints@1.0.2(transitive)
+ Addedhas-property-descriptors@1.0.2(transitive)
+ Addedhas-proto@1.2.0(transitive)
+ Addedhas-symbols@1.1.0(transitive)
+ Addedhas-tostringtag@1.0.2(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedinternal-slot@1.1.0(transitive)
+ Addedis-array-buffer@3.0.4(transitive)
+ Addedis-async-function@2.0.0(transitive)
+ Addedis-bigint@1.1.0(transitive)
+ Addedis-boolean-object@1.2.1(transitive)
+ Addedis-callable@1.2.7(transitive)
+ Addedis-data-view@1.0.2(transitive)
+ Addedis-date-object@1.1.0(transitive)
+ Addedis-finalizationregistry@1.1.0(transitive)
+ Addedis-generator-function@1.0.10(transitive)
+ Addedis-map@2.0.3(transitive)
+ Addedis-negative-zero@2.0.3(transitive)
+ Addedis-number-object@1.1.0(transitive)
+ Addedis-regex@1.2.1(transitive)
+ Addedis-set@2.0.3(transitive)
+ Addedis-shared-array-buffer@1.0.3(transitive)
+ Addedis-string@1.1.0(transitive)
+ Addedis-symbol@1.1.1(transitive)
+ Addedis-typed-array@1.1.13(transitive)
+ Addedis-weakmap@2.0.2(transitive)
+ Addedis-weakref@1.1.0(transitive)
+ Addedis-weakset@2.0.3(transitive)
+ Addedisarray@2.0.5(transitive)
+ Addedmath-intrinsics@1.0.0(transitive)
+ Addedobject-inspect@1.13.3(transitive)
+ Addedobject-keys@1.1.1(transitive)
+ Addedobject.assign@4.1.5(transitive)
+ Addedpossible-typed-array-names@1.0.0(transitive)
+ Addedreflect.getprototypeof@1.0.8(transitive)
+ Addedregexp.prototype.flags@1.5.3(transitive)
+ Addedsafe-array-concat@1.1.3(transitive)
+ Addedsafe-regex-test@1.1.0(transitive)
+ Addedset-function-length@1.2.2(transitive)
+ Addedset-function-name@2.0.2(transitive)
+ Addedside-channel@1.1.0(transitive)
+ Addedside-channel-list@1.0.0(transitive)
+ Addedside-channel-map@1.0.1(transitive)
+ Addedside-channel-weakmap@1.0.2(transitive)
+ Addedstring.prototype.trim@1.2.10(transitive)
+ Addedstring.prototype.trimend@1.0.9(transitive)
+ Addedstring.prototype.trimstart@1.0.8(transitive)
+ Addedstringifier@1.4.1(transitive)
+ Addedtraverse@0.6.10(transitive)
+ Addedtype-name@2.0.2(transitive)
+ Addedtyped-array-buffer@1.0.2(transitive)
+ Addedtyped-array-byte-length@1.0.1(transitive)
+ Addedtyped-array-byte-offset@1.0.3(transitive)
+ Addedtyped-array-length@1.0.7(transitive)
+ Addedtypedarray.prototype.slice@1.0.3(transitive)
+ Addedunbox-primitive@1.0.2(transitive)
+ Addedwhich-boxed-primitive@1.1.0(transitive)
+ Addedwhich-builtin-type@1.2.1(transitive)
+ Addedwhich-collection@1.0.2(transitive)
+ Addedwhich-typed-array@1.1.16(transitive)
- Removedmurmurhash3js@^3.0.1
- Removedmurmurhash3js@3.0.1(transitive)