Skip to content

Instantly share code, notes, and snippets.

@mebinum
Created October 4, 2018 02:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mebinum/268180d4a4b42b8515b118cb1f06b7d4 to your computer and use it in GitHub Desktop.
Save mebinum/268180d4a4b42b8515b118cb1f06b7d4 to your computer and use it in GitHub Desktop.
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).immutabilityHelper=e()}}(function(){return function(){return function e(t,n,r){function o(a,u){if(!n[a]){if(!t[a]){var c="function"==typeof require&&require;if(!u&&c)return c(a,!0);if(i)return i(a,!0);var f=new Error("Cannot find module '"+a+"'");throw f.code="MODULE_NOT_FOUND",f}var s=n[a]={exports:{}};t[a][0].call(s.exports,function(e){return o(t[a][1][e]||e)},s,s.exports,e,t,n,r)}return n[a].exports}for(var i="function"==typeof require&&require,a=0;a<r.length;a++)o(r[a]);return o}}()({1:[function(e,t,n){var r,o,i=t.exports={};function a(){throw new Error("setTimeout has not been defined")}function u(){throw new Error("clearTimeout has not been defined")}function c(e){if(r===setTimeout)return setTimeout(e,0);if((r===a||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:a}catch(e){r=a}try{o="function"==typeof clearTimeout?clearTimeout:u}catch(e){o=u}}();var f,s=[],p=!1,l=-1;function d(){p&&f&&(p=!1,f.length?s=f.concat(s):l=-1,s.length&&y())}function y(){if(!p){var e=c(d);p=!0;for(var t=s.length;t;){for(f=s,s=[];++l<t;)f&&f[l].run();l=-1,t=s.length}f=null,p=!1,function(e){if(o===clearTimeout)return clearTimeout(e);if((o===u||!o)&&clearTimeout)return o=clearTimeout,clearTimeout(e);try{o(e)}catch(t){try{return o.call(null,e)}catch(t){return o.call(this,e)}}}(e)}}function h(e,t){this.fun=e,this.array=t}function g(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];s.push(new h(e,t)),1!==s.length||p||c(y)},h.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=g,i.addListener=g,i.once=g,i.off=g,i.removeListener=g,i.removeAllListeners=g,i.emit=g,i.prependListener=g,i.prependOnceListener=g,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},{}],2:[function(e,t,n){var r=e("invariant"),o=Object.prototype.hasOwnProperty,i=Array.prototype.splice,a=Object.prototype.toString,u=function(e){return a.call(e).slice(8,-1)},c=Object.assign||function(e,t){return f(t).forEach(function(n){o.call(t,n)&&(e[n]=t[n])}),e},f="function"==typeof Object.getOwnPropertySymbols?function(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.keys(e)};function s(e){if(Array.isArray(e))return c(e.constructor(e.length),e);if("Map"===u(e))return new Map(e);if("Set"===u(e))return new Set(e);if(e&&"object"==typeof e){var t=Object.getPrototypeOf(e);return c(Object.create(t),e)}return e}function p(){var e=c({},l);return t.extend=function(t,n){e[t]=n},t.isEquals=function(e,t){return e===t},t;function t(n,i){"function"==typeof i&&(i={$apply:i}),Array.isArray(n)&&Array.isArray(i)||r(!Array.isArray(i),"update(): You provided an invalid spec to update(). The spec may not contain an array except as the value of $set, $push, $unshift, $splice or any custom command allowing an array value."),r("object"==typeof i&&null!==i,"update(): You provided an invalid spec to update(). The spec and every included key path must be plain objects containing one of the following commands: %s.",Object.keys(e).join(", "));var a=n;return f(i).forEach(function(r){if(o.call(e,r)){var c=n===a;a=e[r](i[r],a,i,n),c&&t.isEquals(a,n)&&(a=n)}else{var f="Map"===u(n)?t(n.get(r),i[r]):t(n[r],i[r]),p="Map"===u(a)?a.get(r):a[r];t.isEquals(f,p)&&(void 0!==f||o.call(n,r))||(a===n&&(a=s(n)),"Map"===u(a)?a.set(r,f):a[r]=f)}}),a}}var l={$push:function(e,t,n){return y(t,n,"$push"),e.length?t.concat(e):t},$unshift:function(e,t,n){return y(t,n,"$unshift"),e.length?e.concat(t):t},$splice:function(e,t,n,o){return function(e,t){r(Array.isArray(e),"Expected $splice target to be an array; got %s",e),g(t.$splice)}(t,n),e.forEach(function(e){g(e),t===o&&e.length&&(t=s(o)),i.apply(t,e)}),t},$set:function(e,t,n){return function(e){r(1===Object.keys(e).length,"Cannot have more than one key in an object with $set")}(n),e},$toggle:function(e,t){h(e,"$toggle");var n=e.length?s(t):t;return e.forEach(function(e){n[e]=!t[e]}),n},$unset:function(e,t,n,r){return h(e,"$unset"),e.forEach(function(e){Object.hasOwnProperty.call(t,e)&&(t===r&&(t=s(r)),delete t[e])}),t},$add:function(e,t,n,r){return m(t,"$add"),h(e,"$add"),"Map"===u(t)?e.forEach(function(e){var n=e[0],o=e[1];t===r&&t.get(n)!==o&&(t=s(r)),t.set(n,o)}):e.forEach(function(e){t!==r||t.has(e)||(t=s(r)),t.add(e)}),t},$remove:function(e,t,n,r){return m(t,"$remove"),h(e,"$remove"),e.forEach(function(e){t===r&&t.has(e)&&(t=s(r)),t.delete(e)}),t},$merge:function(e,t,n,o){var i,a;return i=t,r((a=e)&&"object"==typeof a,"update(): $merge expects a spec of type 'object'; got %s",a),r(i&&"object"==typeof i,"update(): $merge expects a target of type 'object'; got %s",i),f(e).forEach(function(n){e[n]!==t[n]&&(t===o&&(t=s(o)),t[n]=e[n])}),t},$apply:function(e,t){var n;return r("function"==typeof(n=e),"update(): expected spec of $apply to be a function; got %s.",n),e(t)}},d=p();function y(e,t,n){r(Array.isArray(e),"update(): expected target of %s to be an array; got %s.",n,e),h(t[n],n)}function h(e,t){r(Array.isArray(e),"update(): expected spec of %s to be an array; got %s. Did you forget to wrap your parameter in an array?",t,e)}function g(e){r(Array.isArray(e),"update(): expected spec of $splice to be an array of arrays; got %s. Did you forget to wrap your parameters in an array?",e)}function m(e,t){var n=u(e);r("Map"===n||"Set"===n,"update(): %s expects a target of type Set or Map; got %s",t,n)}t.exports=d,t.exports.default=d,t.exports.newContext=p},{invariant:3}],3:[function(e,t,n){(function(e){"use strict";t.exports=function(t,n,r,o,i,a,u,c){if("production"!==e.env.NODE_ENV&&void 0===n)throw new Error("invariant requires an error message argument");if(!t){var f;if(void 0===n)f=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var s=[r,o,i,a,u,c],p=0;(f=new Error(n.replace(/%s/g,function(){return s[p++]}))).name="Invariant Violation"}throw f.framesToPop=1,f}}}).call(this,e("_process"))},{_process:1}]},{},[2])(2)});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment