-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathicepick.min.js
1 lines (1 loc) · 3.38 KB
/
icepick.min.js
1
!function(n){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=n();else if("function"==typeof define&&define.amd)define([],n);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).icepick=n()}}(function(){return function n(r,e,t){function o(u,i){if(!e[u]){if(!r[u]){var s="function"==typeof require&&require;if(!i&&s)return s(u,!0);if(c)return c(u,!0);var f=new Error("Cannot find module '"+u+"'");throw f.code="MODULE_NOT_FOUND",f}var a=e[u]={exports:{}};r[u][0].call(a.exports,function(n){var e=r[u][1][n];return o(e||n)},a,a.exports,n,r,e,t)}return e[u].exports}for(var c="function"==typeof require&&require,u=0;u<t.length;u++)o(t[u]);return o}({1:[function(n,r,e){"use strict";function t(n,r){return(r||[]).reduce(function(n,r){if(n)return n[r]},n)}function o(n,r){return Object.keys(r).reduce(function(n,e){return i.assoc(n,e,r[e])},n)}function c(n,r,e){return null==n||null==r?n:Object.keys(r).reduce(function(n,t){var o=r[t],s=n[t],a=e?e(s,o,t):o;return f(o)&&f(s)?a===s?n:Array.isArray(o)?i.assoc(n,t,a):u(n,t,c(s,a,e)):u(n,t,a)},n)}function u(n,r,e){return n[r]===e?n:i.assoc(n,r,e)}var i=e,s=function(n){return n},f=function(n){return null!==n&&(Array.isArray(n)||a(n))},a=function(n){return!("object"!=typeof n||n.constructor!==Object&&null!=n.constructor||Object.getPrototypeOf(n)!==Object.prototype&&null!==Object.getPrototypeOf(n))},l=function(n,r){var e,t;if(Array.isArray(n))for(e=n.length;e--;)r(e);else for(e=(t=Object.keys(n)).length;e--;)r(t[e])},p=function(n){for(var r,e=null==n.constructor?Object.create(null):{},t=Object.keys(n),o=t.length;o--;)e[r=t[o]]=n[r];return e},v=function(n){return Array.isArray(n)?n.slice():p(n)},d=s,h=s;e.freeze=s,e.thaw=function n(r){if(!f(r)||!Object.isFrozen(r))return r;var e=Array.isArray(r)?new Array(r.length):{};return l(r,function(t){e[t]=n(r[t])}),e},e.assoc=function(n,r,e){if(n[r]===e)return h(n);var t=v(n);return t[r]=d(e),h(t)},e.set=e.assoc,e.dissoc=function(n,r){var e=v(n);return delete e[r],h(e)},e.unset=e.dissoc,e.assocIn=function n(r,e,t){var o=e[0];return 1===e.length?i.assoc(r,o,t):i.assoc(r,o,n(r[o]||{},e.slice(1),t))},e.setIn=e.assocIn,e.dissocIn=function n(r,e){var t=e[0];return r.hasOwnProperty(t)?1===e.length?i.dissoc(r,t):i.assoc(r,t,n(r[t],e.slice(1))):r},e.unsetIn=e.dissocIn,e.getIn=t,e.updateIn=function(n,r,e){var o=t(n,r);return i.assocIn(n,r,e(o))},["push","unshift","pop","shift","reverse","sort"].forEach(function(n){e[n]=function(r,e){var t=[].concat(r);return t[n](d(e)),h(t)},e[n].displayName="icepick."+n}),e.splice=function(n){for(var r=[],e=arguments.length-1;e-- >0;)r[e]=arguments[e+1];var t=[].concat(n),o=r.map(d);return t.splice.apply(t,o),h(t)},e.slice=function(n,r,e){var t=n.slice(r,e);return h(t)},["map","filter"].forEach(function(n){e[n]=function(r,e){var t=e[n](r);return h(t)},e[n].displayName="icepick."+n}),e.extend=e.assign=function(n){for(var r=[],e=arguments.length-1;e-- >0;)r[e]=arguments[e+1];var t=r.reduce(o,n);return h(t)},e.merge=c;var y={value:function(){return this.val},thru:function(n){return this.val=d(n(this.val)),this}};Object.keys(e).forEach(function(n){n.match(/^(map|filter)$/)?y[n]=function(r){return this.val=e[n](r,this.val),this}:y[n]=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];return this.val=e[n].apply(e,[this.val].concat(r)),this}}),e.chain=function(n){var r=Object.create(y);return r.val=n,r}},{}]},{},[1])(1)});