forked from rtfeldman/seamless-immutable
-
Notifications
You must be signed in to change notification settings - Fork 0
/
seamless-immutable.production.min.js
1 lines (1 loc) · 7.26 KB
/
seamless-immutable.production.min.js
1
/* (c) 2016, Richard Feldman, github.com/rtfeldman/seamless-immutable/blob/master/LICENSE */!function(){"use strict";function a(b){function c(a){return"object"==typeof a&&!Array.isArray(a)&&null!==a}function d(a){var b=Object.getPrototypeOf(a);return b?Object.create(b):{}}function e(a,b,c){Object.defineProperty(a,b,{enumerable:!1,configurable:!1,writable:!1,value:c})}function f(a){e(a,T,!0)}function g(a){return"object"==typeof a?null===a||Boolean(Object.getOwnPropertyDescriptor(a,T)):!0}function h(a,b){return a===b||a!==a&&b!==b}function i(a){return!(null===a||"object"!=typeof a||Array.isArray(a)||a instanceof Date)}function j(a){this.name="MyError",this.message=a,this.stack=(new Error).stack}function k(a,b){f(a);return a}function l(a,b){var c=a[b];e(a,b,function(){return M(c.apply(a,arguments))})}function m(a,b,c){var d=c&&c.deep;if(a in this&&(d&&this[a]!==b&&i(b)&&i(this[a])&&(b=M.merge(this[a],b,{deep:!0,mode:"replace"})),h(this[a],b)))return this;var e=t.call(this);return e[a]=M(b),o(e)}function n(a,b,c){var d=a[0];if(1===a.length)return m.call(this,d,b,c);var e,f=a.slice(1),g=this[d];if("object"==typeof g&&null!==g)e=M.setIn(g,f,b);else{var h=f[0];e=""!==h&&isFinite(h)?n.call(Z,f,b):z.call($,f,b)}if(d in this&&g===e)return this;var i=t.call(this);return i[d]=e,o(i)}function o(a){for(var b in X)if(X.hasOwnProperty(b)){var c=X[b];l(a,c)}S.use_static||(e(a,"flatMap",r),e(a,"asObject",u),e(a,"asMutable",t),e(a,"set",m),e(a,"setIn",n),e(a,"update",B),e(a,"updateIn",D),e(a,"getIn",E));for(var d=0,f=a.length;f>d;d++)a[d]=M(a[d]);return k(a,W)}function p(a){return S.use_static||e(a,"asMutable",q),k(a,Y)}function q(){return new Date(this.getTime())}function r(a){if(0===arguments.length)return this;var b,c=[],d=this.length;for(b=0;d>b;b++){var e=a(this[b],b,this);Array.isArray(e)?c.push.apply(c,e):c.push(e)}return o(c)}function s(a){if("undefined"==typeof a&&0===arguments.length)return this;if("function"!=typeof a){var b=Array.isArray(a)?a.slice():Array.prototype.slice.call(arguments);b.forEach(function(a,b,c){"number"==typeof a&&(c[b]=a.toString())}),a=function(a,c){return-1!==b.indexOf(c)}}var c=d(this);for(var e in this)this.hasOwnProperty(e)&&a(this[e],e)===!1&&(c[e]=this[e]);return H(c)}function t(a){var b,c,d=[];if(a&&a.deep)for(b=0,c=this.length;c>b;b++)d.push(v(this[b]));else for(b=0,c=this.length;c>b;b++)d.push(this[b]);return d}function u(a){"function"!=typeof a&&(a=function(a){return a});var b,c={},d=this.length;for(b=0;d>b;b++){var e=a(this[b],b,this),f=e[0],g=e[1];c[f]=g}return H(c)}function v(a){return!a||"object"!=typeof a||!Object.getOwnPropertyDescriptor(a,T)||a instanceof Date?a:M.asMutable(a,{deep:!0})}function w(a,b){for(var c in a)Object.getOwnPropertyDescriptor(a,c)&&(b[c]=a[c]);return b}function x(a,b){function c(a,c,e){var g=M(c[e]),j=m&&m(a[e],g,b),l=a[e];if(void 0!==f||void 0!==j||!a.hasOwnProperty(e)||!h(g,l)){var n;n=j?j:k&&i(l)&&i(g)?M.merge(l,g,b):g,h(l,n)&&a.hasOwnProperty(e)||(void 0===f&&(f=w(a,d(a))),f[e]=n)}}function e(a,b){for(var c in a)b.hasOwnProperty(c)||(void 0===f&&(f=w(a,d(a))),delete f[c])}if(0===arguments.length)return this;if(null===a||"object"!=typeof a)throw new TypeError("Immutable#merge can only be invoked with objects or arrays, not "+JSON.stringify(a));var f,g,j=Array.isArray(a),k=b&&b.deep,l=b&&b.mode||"merge",m=b&&b.merger;if(j)for(var n=0,o=a.length;o>n;n++){var p=a[n];for(g in p)p.hasOwnProperty(g)&&c(void 0!==f?f:this,p,g)}else{for(g in a)Object.getOwnPropertyDescriptor(a,g)&&c(this,a,g);"replace"===l&&e(this,a)}return void 0===f?this:H(f)}function y(a,b){var c=b&&b.deep;if(0===arguments.length)return this;if(null===a||"object"!=typeof a)throw new TypeError("Immutable#replace can only be invoked with objects or arrays, not "+JSON.stringify(a));return M.merge(this,a,{deep:c,mode:"replace"})}function z(a,b,c){if(!(a instanceof Array)||0===a.length)throw new TypeError('The first argument to Immutable#setIn must be an array containing at least one "key" string.');var e=a[0];if(1===a.length)return A.call(this,e,b,c);var f,g=a.slice(1),h=this[e];if(f=this.hasOwnProperty(e)&&"object"==typeof h&&null!==h?M.setIn(h,g,b):z.call($,g,b),this.hasOwnProperty(e)&&h===f)return this;var i=w(this,d(this));return i[e]=f,H(i)}function A(a,b,c){var e=c&&c.deep;if(this.hasOwnProperty(a)&&(e&&this[a]!==b&&i(b)&&i(this[a])&&(b=M.merge(this[a],b,{deep:!0,mode:"replace"})),h(this[a],b)))return this;var f=w(this,d(this));return f[a]=M(b),H(f)}function B(a,b){var c=Array.prototype.slice.call(arguments,2),d=this[a];return M.set(this,a,b.apply(d,[d].concat(c)))}function C(a,b){for(var c=0,d=b.length;null!=a&&d>c;c++)a=a[b[c]];return c&&c==d?a:void 0}function D(a,b){var c=Array.prototype.slice.call(arguments,2),d=C(this,a);return M.setIn(this,a,b.apply(d,[d].concat(c)))}function E(a,b){var c=C(this,a);return void 0===c?b:c}function F(a){var b,c=d(this);if(a&&a.deep)for(b in this)this.hasOwnProperty(b)&&(c[b]=v(this[b]));else for(b in this)this.hasOwnProperty(b)&&(c[b]=this[b]);return c}function G(){return{}}function H(a){return S.use_static||(e(a,"merge",x),e(a,"replace",y),e(a,"without",s),e(a,"asMutable",F),e(a,"set",A),e(a,"setIn",z),e(a,"update",B),e(a,"updateIn",D),e(a,"getIn",E)),k(a,U)}function I(a){return"object"==typeof a&&null!==a&&(a.$$typeof===R||a.$$typeof===Q)}function J(a){return"undefined"!=typeof File&&a instanceof File}function K(a){return"object"==typeof a&&"function"==typeof a.then}function L(a){return a instanceof Error}function M(a,b,c){if(g(a)||I(a)||J(a)||L(a))return a;if(K(a))return a.then(M);if(Array.isArray(a))return o(a.slice());if(a instanceof Date)return p(new Date(a.getTime()));var d=b&&b.prototype,e=d&&d!==Object.prototype?function(){return Object.create(d)}:G,f=e();for(var h in a)Object.getOwnPropertyDescriptor(a,h)&&(f[h]=M(a[h],void 0,c));return H(f)}function N(a){function b(){var b=[].slice.call(arguments),c=b.shift();return a.apply(c,b)}return b}function O(a,b){function c(){var c=[].slice.call(arguments),d=c.shift();return Array.isArray(d)?b.apply(d,c):a.apply(d,c)}return c}function P(a,b,c){function d(){var d=[].slice.call(arguments),e=d.shift();return Array.isArray(e)?b.apply(e,d):e instanceof Date?c.apply(e,d):a.apply(e,d)}return d}var Q="function"==typeof Symbol&&Symbol["for"]&&Symbol["for"]("react.element"),R=60103,S={use_static:!1};c(b)&&void 0!==b.use_static&&(S.use_static=Boolean(b.use_static));var T="__immutable_invariants_hold",U=["setPrototypeOf"],V=["keys"],W=U.concat(["push","pop","sort","splice","shift","unshift","reverse"]),X=V.concat(["map","filter","slice","concat","reduce","reduceRight"]),Y=U.concat(["setDate","setFullYear","setHours","setMilliseconds","setMinutes","setMonth","setSeconds","setTime","setUTCDate","setUTCFullYear","setUTCHours","setUTCMilliseconds","setUTCMinutes","setUTCMonth","setUTCSeconds","setYear"]);j.prototype=new Error,j.prototype.constructor=Error;var Z=M([]),$=M({});return M.from=M,M.isImmutable=g,M.ImmutableError=j,M.merge=N(x),M.replace=N(y),M.without=N(s),M.asMutable=P(F,t,q),M.set=O(A,m),M.setIn=O(z,n),M.update=N(B),M.updateIn=N(D),M.getIn=N(E),M.flatMap=N(r),M.asObject=N(u),S.use_static||(M["static"]=a({use_static:!0})),Object.freeze(M),M}var b=a();"function"==typeof define&&define.amd?define(function(){return b}):"object"==typeof module?module.exports=b:"object"==typeof exports?exports.Immutable=b:"object"==typeof window?window.Immutable=b:"object"==typeof global&&(global.Immutable=b)}();