UNPKG

react-addons-update

Version:

>**Note:** >This is a legacy React addon, and is no longer maintained. > >We don't encourage using it in new code, but it exists for backwards compatibility. >The recommended migration path is to use [`immutability-helper`](https://github.com/kolodny/im

1 lines 4.07 kB
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.update=t():(e.React?(e.React.addons=e.React.addons||{}):(function(){throw new Error("react-addons-update could not find the React object. If you are using script tags, make sure that React is being loaded before react-addons-update.")})()).update=t()}(this,function(){return function(e){function t(o){if(r[o])return r[o].exports;var n=r[o]={i:o,l:!1,exports:{}};return e[o].call(n.exports,n,n.exports,t),n.l=!0,n.exports}var r={};return t.m=e,t.c=r,t.i=function(e){return e},t.d=function(e,r,o){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:o})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=2)}([function(e,t,r){"use strict";function o(e,t,r,o,a,c,i,u){if(n(t),!e){var s;if(void 0===t)s=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var f=[r,o,a,c,i,u],p=0;s=new Error(t.replace(/%s/g,function(){return f[p++]})),s.name="Invariant Violation"}throw s.framesToPop=1,s}}var n=function(e){};e.exports=o},function(e,t,r){"use strict";function o(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}var n=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,c=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},r=0;r<10;r++)t["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var o={};return"abcdefghijklmnopqrst".split("").forEach(function(e){o[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},o)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var r,i,u=o(e),s=1;s<arguments.length;s++){r=Object(arguments[s]);for(var f in r)a.call(r,f)&&(u[f]=r[f]);if(n){i=n(r);for(var p=0;p<i.length;p++)c.call(r,i[p])&&(u[i[p]]=r[i[p]])}}return u}},function(e,t,r){"use strict";function o(e){return Array.isArray(e)?e.concat():e&&"object"==typeof e?c(new e.constructor,e):e}function n(e,t,r){i(Array.isArray(e),"update(): expected target of %s to be an array; got %s.",r,e);var o=t[r];i(Array.isArray(o),"update(): expected spec of %s to be an array; got %s. Did you forget to wrap your parameter in an array?",r,o)}function a(e,t){if(i("object"==typeof t,"update(): You provided a key path to update() that did not contain one of %s. Did you forget to include {%s: ...}?",b.join(", "),y),u.call(t,y))return i(1===Object.keys(t).length,"Cannot have more than one key in an object with %s",y),t[y];var r=o(e);if(u.call(t,l)){var h=t[l];i(h&&"object"==typeof h,"update(): %s expects a spec of type 'object'; got %s",l,h),i(r&&"object"==typeof r,"update(): %s expects a target of type 'object'; got %s",l,r),c(r,t[l])}u.call(t,s)&&(n(e,t,s),t[s].forEach(function(e){r.push(e)})),u.call(t,f)&&(n(e,t,f),t[f].forEach(function(e){r.unshift(e)})),u.call(t,p)&&(i(Array.isArray(e),"Expected %s target to be an array; got %s",p,e),i(Array.isArray(t[p]),"update(): expected spec of %s to be an array of arrays; got %s. Did you forget to wrap your parameters in an array?",p,t[p]),t[p].forEach(function(e){i(Array.isArray(e),"update(): expected spec of %s to be an array of arrays; got %s. Did you forget to wrap your parameters in an array?",p,t[p]),r.splice.apply(r,e)})),u.call(t,d)&&(i("function"==typeof t[d],"update(): expected spec of %s to be a function; got %s.",d,t[d]),r=t[d](r));for(var j in t)g.hasOwnProperty(j)&&g[j]||(r[j]=a(e[j],t[j]));return r}var c=r(1),i=r(0),u={}.hasOwnProperty,s="$push",f="$unshift",p="$splice",y="$set",l="$merge",d="$apply",b=[s,f,p,y,l,d],g={};b.forEach(function(e){g[e]=!0}),e.exports=a}])});