seamless-immutable
Advanced tools
Comparing version 7.1.1 to 7.1.2
{ | ||
"name": "seamless-immutable", | ||
"version": "7.1.1", | ||
"version": "7.1.2", | ||
"description": "Immutable data structures for JavaScript which are backwards-compatible with normal JS Arrays and Objects.", | ||
@@ -5,0 +5,0 @@ "main": "src/seamless-immutable.js", |
@@ -43,3 +43,3 @@ seamless-immutable | ||
By popular demand, functions, dates, and [React](https://facebook.github.io/react/) | ||
By popular demand, functions, errors, dates, and [React](https://facebook.github.io/react/) | ||
components are treated as immutable even though technically they can be mutated. | ||
@@ -252,3 +252,3 @@ (It turns out that trying to make these immutable leads to more bad things | ||
// returns Immutable({status: "sweet", errors: 2}) | ||
// because passing an Array (or just multiple arguments) is shorthand for | ||
// because passing an Array is shorthand for | ||
// invoking a separate merge for each object in turn. | ||
@@ -263,3 +263,3 @@ ``` | ||
A second argument can be provided to perform a deep merge: `{deep: true}`. | ||
A third argument can be provided to perform a deep merge: `{deep: true}`. | ||
@@ -397,2 +397,6 @@ ### replace | ||
#### 7.1.2 | ||
Treat `Error` instances as immutable. | ||
#### 7.1.1 | ||
@@ -399,0 +403,0 @@ |
@@ -620,4 +620,8 @@ (function() { | ||
function isError(obj) { | ||
return obj instanceof Error; | ||
} | ||
function Immutable(obj, options, stackRemaining) { | ||
if (isImmutable(obj) || isReactElement(obj) || isFileObject(obj)) { | ||
if (isImmutable(obj) || isReactElement(obj) || isFileObject(obj) || isError(obj)) { | ||
return obj; | ||
@@ -624,0 +628,0 @@ } else if (isPromise(obj)) { |
@@ -1,1 +0,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,b){e(a,b,function(){throw new k("The "+b+" method cannot be invoked on an Immutable data structure.")})}function g(a){e(a,T,!0)}function h(a){return"object"==typeof a?null===a||Boolean(Object.getOwnPropertyDescriptor(a,T)):!0}function i(a,b){return a===b||a!==a&&b!==b}function j(a){return!(null===a||"object"!=typeof a||Array.isArray(a)||a instanceof Date)}function k(a){this.name="MyError",this.message=a,this.stack=(new Error).stack}function l(a,b){g(a);for(var c in b)b.hasOwnProperty(c)&&f(a,b[c]);return Object.freeze(a),a}function m(a,b){var c=a[b];e(a,b,function(){return M(c.apply(a,arguments))})}function n(a,b,c){var d=c&&c.deep;if(a in this&&(d&&this[a]!==b&&j(b)&&j(this[a])&&(b=M.merge(this[a],b,{deep:!0,mode:"replace"})),i(this[a],b)))return this;var e=u.call(this);return e[a]=M(b),p(e)}function o(a,b,c){var d=a[0];if(1===a.length)return n.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)?o.call(Z,f,b):A.call($,f,b)}if(d in this&&g===e)return this;var i=u.call(this);return i[d]=e,p(i)}function p(a){for(var b in X)if(X.hasOwnProperty(b)){var c=X[b];m(a,c)}S.use_static||(e(a,"flatMap",s),e(a,"asObject",v),e(a,"asMutable",u),e(a,"set",n),e(a,"setIn",o),e(a,"update",C),e(a,"updateIn",E),e(a,"getIn",F));for(var d=0,f=a.length;f>d;d++)a[d]=M(a[d]);return l(a,W)}function q(a){return S.use_static||e(a,"asMutable",r),l(a,Y)}function r(){return new Date(this.getTime())}function s(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 p(c)}function t(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 I(c)}function u(a){var b,c,d=[];if(a&&a.deep)for(b=0,c=this.length;c>b;b++)d.push(w(this[b]));else for(b=0,c=this.length;c>b;b++)d.push(this[b]);return d}function v(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 I(c)}function w(a){return!a||"object"!=typeof a||!Object.getOwnPropertyDescriptor(a,T)||a instanceof Date?a:M.asMutable(a,{deep:!0})}function x(a,b){for(var c in a)Object.getOwnPropertyDescriptor(a,c)&&(b[c]=a[c]);return b}function y(a,b){function c(a,c,e){var g=M(c[e]),h=m&&m(a[e],g,b),l=a[e];if(void 0!==f||void 0!==h||!a.hasOwnProperty(e)||!i(g,l)){var n;n=h?h:k&&j(l)&&j(g)?M.merge(l,g,b):g,i(l,n)&&a.hasOwnProperty(e)||(void 0===f&&(f=x(a,d(a))),f[e]=n)}}function e(a,b){for(var c in a)b.hasOwnProperty(c)||(void 0===f&&(f=x(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,h=Array.isArray(a),k=b&&b.deep,l=b&&b.mode||"merge",m=b&&b.merger;if(h)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:I(f)}function z(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 A(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 B.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):A.call($,g,b),this.hasOwnProperty(e)&&h===f)return this;var i=x(this,d(this));return i[e]=f,I(i)}function B(a,b,c){var e=c&&c.deep;if(this.hasOwnProperty(a)&&(e&&this[a]!==b&&j(b)&&j(this[a])&&(b=M.merge(this[a],b,{deep:!0,mode:"replace"})),i(this[a],b)))return this;var f=x(this,d(this));return f[a]=M(b),I(f)}function C(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 D(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 E(a,b){var c=Array.prototype.slice.call(arguments,2),d=D(this,a);return M.setIn(this,a,b.apply(d,[d].concat(c)))}function F(a,b){var c=D(this,a);return void 0===c?b:c}function G(a){var b,c=d(this);if(a&&a.deep)for(b in this)this.hasOwnProperty(b)&&(c[b]=w(this[b]));else for(b in this)this.hasOwnProperty(b)&&(c[b]=this[b]);return c}function H(){return{}}function I(a){return S.use_static||(e(a,"merge",y),e(a,"replace",z),e(a,"without",t),e(a,"asMutable",G),e(a,"set",B),e(a,"setIn",A),e(a,"update",C),e(a,"updateIn",E),e(a,"getIn",F)),l(a,U)}function J(a){return"object"==typeof a&&null!==a&&(a.$$typeof===R||a.$$typeof===Q)}function K(a){return"undefined"!=typeof File&&a instanceof File}function L(a){return"object"==typeof a&&"function"==typeof a.then}function M(a,b,c){if(h(a)||J(a)||K(a))return a;if(L(a))return a.then(M);if(Array.isArray(a))return p(a.slice());if(a instanceof Date)return q(new Date(a.getTime()));var d=b&&b.prototype,e=d&&d!==Object.prototype?function(){return Object.create(d)}:H,f=e();if(null==c&&(c=64),0>=c)throw new k("Attempt to construct Immutable from a deeply nested object was detected. Have you tried to wrap an object with circular references (e.g. React element)? See https://github.com/rtfeldman/seamless-immutable/wiki/Deeply-nested-object-was-detected for details.");c-=1;for(var g in a)Object.getOwnPropertyDescriptor(a,g)&&(f[g]=M(a[g],void 0,c));return I(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"]);k.prototype=new Error,k.prototype.constructor=Error;var Z=M([]),$=M({});return M.from=M,M.isImmutable=h,M.ImmutableError=k,M.merge=N(y),M.replace=N(z),M.without=N(t),M.asMutable=P(G,u,r),M.set=O(B,n),M.setIn=O(A,o),M.update=N(C),M.updateIn=N(E),M.getIn=N(F),M.flatMap=N(s),M.asObject=N(v),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)}(); | ||
/* (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,b){e(a,b,function(){throw new k("The "+b+" method cannot be invoked on an Immutable data structure.")})}function g(a){e(a,U,!0)}function h(a){return"object"==typeof a?null===a||Boolean(Object.getOwnPropertyDescriptor(a,U)):!0}function i(a,b){return a===b||a!==a&&b!==b}function j(a){return!(null===a||"object"!=typeof a||Array.isArray(a)||a instanceof Date)}function k(a){this.name="MyError",this.message=a,this.stack=(new Error).stack}function l(a,b){g(a);for(var c in b)b.hasOwnProperty(c)&&f(a,b[c]);return Object.freeze(a),a}function m(a,b){var c=a[b];e(a,b,function(){return N(c.apply(a,arguments))})}function n(a,b,c){var d=c&&c.deep;if(a in this&&(d&&this[a]!==b&&j(b)&&j(this[a])&&(b=N.merge(this[a],b,{deep:!0,mode:"replace"})),i(this[a],b)))return this;var e=u.call(this);return e[a]=N(b),p(e)}function o(a,b,c){var d=a[0];if(1===a.length)return n.call(this,d,b,c);var e,f=a.slice(1),g=this[d];if("object"==typeof g&&null!==g)e=N.setIn(g,f,b);else{var h=f[0];e=""!==h&&isFinite(h)?o.call($,f,b):A.call(_,f,b)}if(d in this&&g===e)return this;var i=u.call(this);return i[d]=e,p(i)}function p(a){for(var b in Y)if(Y.hasOwnProperty(b)){var c=Y[b];m(a,c)}T.use_static||(e(a,"flatMap",s),e(a,"asObject",v),e(a,"asMutable",u),e(a,"set",n),e(a,"setIn",o),e(a,"update",C),e(a,"updateIn",E),e(a,"getIn",F));for(var d=0,f=a.length;f>d;d++)a[d]=N(a[d]);return l(a,X)}function q(a){return T.use_static||e(a,"asMutable",r),l(a,Z)}function r(){return new Date(this.getTime())}function s(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 p(c)}function t(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 I(c)}function u(a){var b,c,d=[];if(a&&a.deep)for(b=0,c=this.length;c>b;b++)d.push(w(this[b]));else for(b=0,c=this.length;c>b;b++)d.push(this[b]);return d}function v(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 I(c)}function w(a){return!a||"object"!=typeof a||!Object.getOwnPropertyDescriptor(a,U)||a instanceof Date?a:N.asMutable(a,{deep:!0})}function x(a,b){for(var c in a)Object.getOwnPropertyDescriptor(a,c)&&(b[c]=a[c]);return b}function y(a,b){function c(a,c,e){var g=N(c[e]),h=m&&m(a[e],g,b),l=a[e];if(void 0!==f||void 0!==h||!a.hasOwnProperty(e)||!i(g,l)){var n;n=h?h:k&&j(l)&&j(g)?N.merge(l,g,b):g,i(l,n)&&a.hasOwnProperty(e)||(void 0===f&&(f=x(a,d(a))),f[e]=n)}}function e(a,b){for(var c in a)b.hasOwnProperty(c)||(void 0===f&&(f=x(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,h=Array.isArray(a),k=b&&b.deep,l=b&&b.mode||"merge",m=b&&b.merger;if(h)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:I(f)}function z(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 N.merge(this,a,{deep:c,mode:"replace"})}function A(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 B.call(this,e,b,c);var f,g=a.slice(1),h=this[e];if(f=this.hasOwnProperty(e)&&"object"==typeof h&&null!==h?N.setIn(h,g,b):A.call(_,g,b),this.hasOwnProperty(e)&&h===f)return this;var i=x(this,d(this));return i[e]=f,I(i)}function B(a,b,c){var e=c&&c.deep;if(this.hasOwnProperty(a)&&(e&&this[a]!==b&&j(b)&&j(this[a])&&(b=N.merge(this[a],b,{deep:!0,mode:"replace"})),i(this[a],b)))return this;var f=x(this,d(this));return f[a]=N(b),I(f)}function C(a,b){var c=Array.prototype.slice.call(arguments,2),d=this[a];return N.set(this,a,b.apply(d,[d].concat(c)))}function D(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 E(a,b){var c=Array.prototype.slice.call(arguments,2),d=D(this,a);return N.setIn(this,a,b.apply(d,[d].concat(c)))}function F(a,b){var c=D(this,a);return void 0===c?b:c}function G(a){var b,c=d(this);if(a&&a.deep)for(b in this)this.hasOwnProperty(b)&&(c[b]=w(this[b]));else for(b in this)this.hasOwnProperty(b)&&(c[b]=this[b]);return c}function H(){return{}}function I(a){return T.use_static||(e(a,"merge",y),e(a,"replace",z),e(a,"without",t),e(a,"asMutable",G),e(a,"set",B),e(a,"setIn",A),e(a,"update",C),e(a,"updateIn",E),e(a,"getIn",F)),l(a,V)}function J(a){return"object"==typeof a&&null!==a&&(a.$$typeof===S||a.$$typeof===R)}function K(a){return"undefined"!=typeof File&&a instanceof File}function L(a){return"object"==typeof a&&"function"==typeof a.then}function M(a){return a instanceof Error}function N(a,b,c){if(h(a)||J(a)||K(a)||M(a))return a;if(L(a))return a.then(N);if(Array.isArray(a))return p(a.slice());if(a instanceof Date)return q(new Date(a.getTime()));var d=b&&b.prototype,e=d&&d!==Object.prototype?function(){return Object.create(d)}:H,f=e();if(null==c&&(c=64),0>=c)throw new k("Attempt to construct Immutable from a deeply nested object was detected. Have you tried to wrap an object with circular references (e.g. React element)? See https://github.com/rtfeldman/seamless-immutable/wiki/Deeply-nested-object-was-detected for details.");c-=1;for(var g in a)Object.getOwnPropertyDescriptor(a,g)&&(f[g]=N(a[g],void 0,c));return I(f)}function O(a){function b(){var b=[].slice.call(arguments),c=b.shift();return a.apply(c,b)}return b}function P(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 Q(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 R="function"==typeof Symbol&&Symbol["for"]&&Symbol["for"]("react.element"),S=60103,T={use_static:!1};c(b)&&void 0!==b.use_static&&(T.use_static=Boolean(b.use_static));var U="__immutable_invariants_hold",V=["setPrototypeOf"],W=["keys"],X=V.concat(["push","pop","sort","splice","shift","unshift","reverse"]),Y=W.concat(["map","filter","slice","concat","reduce","reduceRight"]),Z=V.concat(["setDate","setFullYear","setHours","setMilliseconds","setMinutes","setMonth","setSeconds","setTime","setUTCDate","setUTCFullYear","setUTCHours","setUTCMilliseconds","setUTCMinutes","setUTCMonth","setUTCSeconds","setYear"]);k.prototype=new Error,k.prototype.constructor=Error;var $=N([]),_=N({});return N.from=N,N.isImmutable=h,N.ImmutableError=k,N.merge=O(y),N.replace=O(z),N.without=O(t),N.asMutable=Q(G,u,r),N.set=P(B,n),N.setIn=P(A,o),N.update=O(C),N.updateIn=O(E),N.getIn=O(F),N.flatMap=O(s),N.asObject=O(v),T.use_static||(N["static"]=a({use_static:!0})),Object.freeze(N),N}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)}(); |
@@ -1,1 +0,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,S,!0)}function g(a){return"object"==typeof a?null===a||Boolean(Object.getOwnPropertyDescriptor(a,S)):!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 L(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=L.merge(this[a],b,{deep:!0,mode:"replace"})),h(this[a],b)))return this;var e=t.call(this);return e[a]=L(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=L.setIn(g,f,b);else{var h=f[0];e=""!==h&&isFinite(h)?n.call(Y,f,b):z.call(Z,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 W)if(W.hasOwnProperty(b)){var c=W[b];l(a,c)}R.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]=L(a[d]);return k(a,V)}function p(a){return R.use_static||e(a,"asMutable",q),k(a,X)}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,S)||a instanceof Date?a:L.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=L(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)?L.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 L.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?L.setIn(h,g,b):z.call(Z,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=L.merge(this[a],b,{deep:!0,mode:"replace"})),h(this[a],b)))return this;var f=w(this,d(this));return f[a]=L(b),H(f)}function B(a,b){var c=Array.prototype.slice.call(arguments,2),d=this[a];return L.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 L.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 R.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,T)}function I(a){return"object"==typeof a&&null!==a&&(a.$$typeof===Q||a.$$typeof===P)}function J(a){return"undefined"!=typeof File&&a instanceof File}function K(a){return"object"==typeof a&&"function"==typeof a.then}function L(a,b,c){if(g(a)||I(a)||J(a))return a;if(K(a))return a.then(L);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]=L(a[h],void 0,c));return H(f)}function M(a){function b(){var b=[].slice.call(arguments),c=b.shift();return a.apply(c,b)}return b}function N(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 O(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 P="function"==typeof Symbol&&Symbol["for"]&&Symbol["for"]("react.element"),Q=60103,R={use_static:!1};c(b)&&void 0!==b.use_static&&(R.use_static=Boolean(b.use_static));var S="__immutable_invariants_hold",T=["setPrototypeOf"],U=["keys"],V=T.concat(["push","pop","sort","splice","shift","unshift","reverse"]),W=U.concat(["map","filter","slice","concat","reduce","reduceRight"]),X=T.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 Y=L([]),Z=L({});return L.from=L,L.isImmutable=g,L.ImmutableError=j,L.merge=M(x),L.replace=M(y),L.without=M(s),L.asMutable=O(F,t,q),L.set=N(A,m),L.setIn=N(z,n),L.update=M(B),L.updateIn=M(D),L.getIn=M(E),L.flatMap=M(r),L.asObject=M(u),R.use_static||(L["static"]=a({use_static:!0})),Object.freeze(L),L}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)}(); | ||
/* (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)}(); |
@@ -620,4 +620,8 @@ (function() { | ||
function isError(obj) { | ||
return obj instanceof Error; | ||
} | ||
function Immutable(obj, options, stackRemaining) { | ||
if (isImmutable(obj) || isReactElement(obj) || isFileObject(obj)) { | ||
if (isImmutable(obj) || isReactElement(obj) || isFileObject(obj) || isError(obj)) { | ||
return obj; | ||
@@ -624,0 +628,0 @@ } else if (isPromise(obj)) { |
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
86774
1262
557