forked from lodash/lodash
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lodash.core.min.js
30 lines (30 loc) · 12.7 KB
/
lodash.core.min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/**
* @license
* lodash 3.10.1 (Custom Build) lodash.com/license | Underscore.js 1.8.3 underscorejs.org/LICENSE
* Build: `lodash core exports="global,amd" -o ./lodash.core.js`
*/
;(function(){function n(n,t,r,e){for(var u=-1,o=n.length,i=e,c=i;++u<o;){var f=n[u],a=+t(f);(r(a,i)||a===e&&a===c)&&(i=a,c=f)}return c}function t(n,t){for(var r=-1,e=t.length,u=n.length;++r<e;)n[u+r]=t[r];return n}function r(n,t,r){var e;return r(n,function(n,r,u){return t(n,r,u)?(e=n,false):void 0}),e}function e(n,t,r,e,u){return u(n,function(n,u,o){r=e?(e=false,n):t(r,n,u,o)}),r}function u(n,t){return O(t,function(t){return n[t]})}function o(n){return n&&n.Object===Object?n:null}function i(n,t,r,e){r||(r={});
for(var u=-1,o=t.length;++u<o;){var i=t[u],c=e?e(r[i],n[i],i,r,n):n[i],f=r[i];(c===c?c===f:f!==f)&&(c!==en||i in r)||(r[i]=c)}return r}function c(n){return ln[n]}function f(n,t){return n===en?t:n}function a(n){var t=false;if(null!=n&&typeof n.toString!="function")try{t=!!(n+"")}catch(r){}return t}function l(n,t){return n=typeof n=="number"||an.test(n)?+n:-1,n>-1&&0==n%1&&(null==t?9007199254740991:t)>n}function p(n){return typeof n=="number"&&n>-1&&0==n%1&&9007199254740991>=n}function s(n){if(K(n)&&!qn(n)){
if(n instanceof h)return n;if(mn.call(n,"__wrapped__")){var t=new h(n.__wrapped__,n.__chain__);return t.__actions__=Dn(n.__actions__),t}}return new h(n)}function h(n,t){this.__wrapped__=n,this.__actions__=[],this.__chain__=!!t}function y(n,t,r){if(typeof n!="function")throw new TypeError("Expected a function");return setTimeout(function(){n.apply(en,r)},t)}function v(n,t){var r=true;return Fn(n,function(n,e,u){return r=!!t(n,e,u)}),r}function _(n,t){var r=[];return Fn(n,function(n,e,u){t(n,e,u)&&r.push(n);
}),r}function g(n,r,e,u){u||(u=[]);for(var o=-1,i=n.length;++o<i;){var c=n[o];H(c)&&V(c)&&(e||qn(c)||U(c))?r?g(c,r,e,u):t(u,c):e||(u[u.length]=c)}return u}function b(n,t){return n&&Bn(n,t,X)}function j(n,t){return _(t,function(t){return G(n[t])})}function m(n,t,r,e,u,o){if(n===t)n=true;else if(null==n||null==t||!H(n)&&!K(t))n=n!==n&&t!==t;else n:{var i=qn(n),c=qn(t),f="[object Array]",l="[object Array]";i||(f=wn.call(n),"[object Arguments]"==f&&(f="[object Object]")),c||(l=wn.call(t),"[object Arguments]"==l&&(l="[object Object]"));
var p="[object Object]"==f&&!a(n),c="[object Object]"==l&&!a(t),l=f==l;if(!l||i||p){if(!(2&e)&&(f=p&&mn.call(n,"__wrapped__"),c=c&&mn.call(t,"__wrapped__"),f||c)){n=m(f?n.value():n,c?t.value():t,r,e,u,o);break n}if(l){for(u||(u=[]),o||(o=[]),f=u.length;f--;)if(u[f]==n){n=o[f]==t;break n}u.push(n),o.push(t),n=(i?D:I)(n,t,m,r,e,u,o),u.pop(),o.pop()}else n=false}else n=R(n,t,f)}return n}function d(n){var t=typeof n;return"function"==t?n:null==n?tn:("object"==t?E:A)(n)}function w(n){n=null==n?n:Object(n);
var t,r=[];for(t in n)r.push(t);return r}function O(n,t){var r=-1,e=V(n)?Array(n.length):[];return Fn(n,function(n,u,o){e[++r]=t(n,u,o)}),e}function E(n){var t=X(n),r=t.length;return function(e){if(null==e)return!r;for(e=Object(e);r--;){var u=t[r];if(!(u in e&&m(n[u],e[u],en,true)))return false}return true}}function x(n,t){return n=Object(n),e(t,function(t,r){return r in n&&(t[r]=n[r]),t},{})}function A(n){return function(t){return null==t?en:t[n]}}function k(n,t,r){var e=-1,u=n.length;for(t=null==t?0:An(t)||0,
0>t&&(t=-t>u?0:u+t),r=r===en||r>u?u:An(r)||0,0>r&&(r+=u),u=t>r?0:r-t>>>0,t>>>=0,r=Array(u);++e<u;)r[e]=n[e+t];return r}function N(n,t){var r;return Fn(n,function(n,e,u){return r=t(n,e,u),!r}),!!r}function S(n,r){return e(r,function(n,r){return r.func.apply(r.thisArg,t([n],r.args))},n)}function T(n){return J(function(t,r){var e=-1,u=null==t?0:r.length,o=u>1?r[u-1]:en,o=typeof o=="function"?(u--,o):en;for(t=Object(t);++e<u;){var i=r[e];i&&n(t,i,o)}return t})}function F(n){return function(){var t=arguments,r=Tn(n.prototype),t=n.apply(r,t);
return H(t)?t:r}}function B(n,t,r){function e(){for(var o=-1,i=arguments.length,c=-1,f=r.length,a=Array(f+i);++c<f;)a[c]=r[c];for(;i--;)a[c++]=arguments[++o];return(this&&this!==_n&&this instanceof e?u:n).apply(t,a)}if(typeof n!="function")throw new TypeError("Expected a function");var u=F(n);return e}function D(n,t,r,e,u,o,i){var c=-1,f=1&u,a=n.length,l=t.length;if(a!=l&&!(2&u&&l>a))return false;for(;++c<a;){var p=n[c],l=t[c];if(Z!==en){if(Z)continue;return false}if(f){if(!N(t,function(n){return p===n||r(p,n,e,u,o,i);
}))return false}else if(p!==l&&!r(p,l,e,u,o,i))return false}return true}function R(n,t,r){switch(r){case"[object Boolean]":case"[object Date]":return+n==+t;case"[object Error]":return n.name==t.name&&n.message==t.message;case"[object Number]":return n!=+n?t!=+t:n==+t;case"[object RegExp]":case"[object String]":return n==t+""}return false}function I(n,t,r,e,u,o,i){var c=2&u,f=1&u,a=X(n),l=a.length,p=X(t);if(l!=p.length&&!c)return false;for(var s=l;s--;){var h=a[s];if(!(c?h in t:mn.call(t,h))||!f&&h!=p[s])return false}for(;++s<l;){
if(h=a[s],f=n[h],p=t[h],Z===en?f!==p&&!r(f,p,e,u,o,i):!Z)return false;c||(c="constructor"==h)}return c||(r=n.constructor,e=t.constructor,!(r!=e&&"constructor"in n&&"constructor"in t)||typeof r=="function"&&r instanceof r&&typeof e=="function"&&e instanceof e)?true:false}function $(n){var t=n?n.length:0;n=t=t&&p(t)&&(qn(n)||U(n)||Q(n))&&t||0;for(var t=String,r=-1,e=Array(n);++r<n;)e[r]=t(r);return e}function q(n){var t=n&&n.constructor;return n===(typeof t=="function"&&t.prototype||bn)}function M(n,t){return Fn(n,typeof t=="function"?t:tn);
}function z(n){return null==n?0:(n=V(n)?n:X(n),n.length)}function C(n,t){var r;if(typeof t!="function")throw new TypeError("Expected a function");return n=An(n)||0,function(){return 0<--n&&(r=t.apply(this,arguments)),1>=n&&(t=en),r}}function J(n){var t;if(typeof n!="function")throw new TypeError("Expected a function");return t=Sn(t===en?n.length-1:An(t)||0,0),function(){for(var r=arguments,e=-1,u=Sn(r.length-t,0),o=Array(u);++e<u;)o[e]=r[t+e];for(u=Array(t+1),e=-1;++e<t;)u[e]=r[e];return u[t]=o,n.apply(this,u);
}}function P(n,t){return n>t}function U(n){return K(n)&&V(n)&&mn.call(n,"callee")&&(!xn.call(n,"callee")||"[object Arguments]"==wn.call(n))}function V(n){return null!=n&&!(typeof n=="function"&&"[object Function]"==wn.call(n))&&p(Rn(n))}function G(n){return H(n)&&"[object Function]"==wn.call(n)}function H(n){var t=typeof n;return!!n&&("object"==t||"function"==t)}function K(n){return!!n&&typeof n=="object"}function L(n){return typeof n=="number"||K(n)&&"[object Number]"==wn.call(n)}function Q(n){return typeof n=="string"||K(n)&&"[object String]"==wn.call(n);
}function W(n,t){return t>n}function X(n){var t=q(n);if(!t&&!V(n))return Nn(Object(n));var r,e=$(n),u=e.length,o=!!u;for(r in n)!mn.call(n,r)||o&&l(r,u)||t&&"constructor"==r||e.push(r);return e}function Y(n){for(var t=-1,r=q(n),e=w(n),u=e.length,o=$(n),i=o.length,c=!!i;++t<u;){var f=e[t];c&&l(f,i)||"constructor"==f&&(r||!mn.call(n,f))||o.push(f)}return o}function Z(n,t,r){return t=null==n?en:n[t],t===en&&(t=r),G(t)?t.call(n):t}function nn(n){return n?u(n,X(n)):[]}function tn(n){return n}function rn(n,r,e){
var u=X(r),o=j(r,u);null!=e||H(r)&&(o.length||!u.length)||(e=r,r=n,n=this,o=j(r,X(r)));var i=H(e)&&"chain"in e?e.chain:true,c=G(n);return Fn(o,function(e){var u=r[e];n[e]=u,c&&(n.prototype[e]=function(){var r=this.__chain__;if(i||r){var e=n(this.__wrapped__);return(e.__actions__=Dn(this.__actions__)).push({func:u,args:arguments,thisArg:n}),e.__chain__=r,e}return u.apply(n,t([this.value()],arguments))})}),n}var en,un=1/-0,on=1/0,cn=/[&<>"'`]/g,fn=RegExp(cn.source),an=/^\d+$/,ln={"&":"&","<":"<",
">":">",'"':""","'":"'","`":"`"},pn={"function":true,object:true},sn=pn[typeof module]&&module&&!module.nodeType?module:null,hn=o(pn[typeof self]&&self),yn=o(pn[typeof window]&&window),vn=o(pn[typeof this]&&this),_n=o((pn[typeof exports]&&exports&&!exports.nodeType?exports:null)&&sn&&typeof global=="object"&&global)||yn!==(vn&&vn.window)&&yn||hn||vn||Function("return this")(),gn=Array.prototype,bn=Object.prototype,jn=String.prototype,mn=bn.hasOwnProperty,dn=0,wn=bn.toString,On=_n._,En=(pn=_n.f)?pn.g:en,xn=bn.propertyIsEnumerable,An=Math.floor,kn=_n.isFinite,Nn=Object.keys,Sn=Math.max,Tn=function(){
function n(){}return function(t){if(H(t)){n.prototype=t;var r=new n;n.prototype=en}return r||{}}}(),Fn=function(n,t){return function(r,e){if(null==r)return r;if(!V(r))return n(r,e);for(var u=r.length,o=t?u:-1,i=Object(r);(t?o--:++o<u)&&false!==e(i[o],o,i););return r}}(b),Bn=function(n){return function(t,r,e){var u=Object(t);e=e(t);for(var o=e.length,i=n?o:-1;n?i--:++i<o;){var c=e[i];if(false===r(u[c],c,u))break}return t}}();En&&!xn.call({valueOf:1},"valueOf")&&(w=function(n){n=En(n);for(var t,r=[];!(t=n.next()).done;)r.push(t.value);
return r});var Dn=k,Rn=A("length");J(function(n){return n=g(n),this.thru(function(n){return n=qn(n)?n:[Object(n)],t(Dn(n),nn)})});var pn=J(function(n,t,r){var e=typeof t=="function";return O(n,function(n){var u=e?t:n[t];return null==u?u:u.apply(n,r)})}),sn=Date.now,vn=J(function(n,t,r){return B(n,t,r)}),In=J(function(n,t){return y(n,1,t)}),$n=J(function(n,t,r){return y(n,t,r)}),qn=Array.isArray,Mn=J(function(n){return n.push(en,f),Cn.apply(en,n)}),zn=T(function(n,t){var r=Y(t);i(t,r,n)}),Cn=T(function(n,t,r){
i(t,Y(t),n,r)}),Jn=J(function(n,t){return null==n?{}:x(n,g(t))});h.prototype=Tn(s.prototype),h.prototype.constructor=h,s.before=C,s.bind=vn,s.chain=function(n){return n=s(n),n.__chain__=true,n},s.compact=function(n){return _(n,Boolean)},s.defaults=Mn,s.defer=In,s.delay=$n,s.extend=zn,s.filter=function(n,t){return _(n,d(t))},s.flatten=function(n){return n&&n.length?g(n):[]},s.flattenDeep=function(n){return n&&n.length?g(n,true):[]},s.functions=function(n){return null==n?[]:j(n,Y(n))},s.invoke=pn,s.iteratee=d,
s.keys=X,s.keysIn=Y,s.map=function(n,t){return O(n,d(t))},s.mixin=rn,s.negate=function(n){if(typeof n!="function")throw new TypeError("Expected a function");return function(){return!n.apply(this,arguments)}},s.once=function(n){return C(2,n)},s.pick=Jn,s.slice=function(n,t,r){return n&&n.length?k(n,t,r):[]},s.sortBy=function(n,t){var r=0;return t=d(t),O(O(n,function(n,e,u){return{c:n,b:r++,a:t(n,e,u)}}).sort(function(n,t){var r;n:{r=n.a;var e=t.a;if(r!==e){var u=null===r,o=r===en,i=r===r,c=null===e,f=e===en,a=e===e;
if(r>e&&!c||!i||u&&!f&&a||o&&a){r=1;break n}if(e>r&&!u||!a||c&&!o&&i||f&&i){r=-1;break n}}r=0}return r||n.b-t.b}),A("c"))},s.tap=function(n,t){return t(n),n},s.thru=function(n,t){return t(n)},s.toArray=function(n){return V(n)?n.length?Dn(n):[]:nn(n)},s.values=nn,s.each=M,rn(s,s),s.clone=function(n){if(H(n))if(qn(n))n=Dn(n);else{var t=X(n);n=i(n,t,void 0)}return n},s.escape=function(n){return(n=null==n?"":n+"")&&fn.test(n)?n.replace(cn,c):n},s.every=function(n,t,r){return t=r?en:t,v(n,d(t))},s.find=function(n,t){
return r(n,d(t),Fn)},s.first=function(n){return n?n[0]:en},s.forEach=M,s.has=function(n,t){return null!=n&&mn.call(n,t)},s.identity=tn,s.indexOf=function(n,t,r){var e=n?n.length:0;r=typeof r=="number"?0>r?Sn(e+r,0):r:0,r=(r||0)-1;for(var u=t===t;++r<e;){var o=n[r];if(u?o===t:o!==o)return r}return-1},s.isArguments=U,s.isArray=qn,s.isBoolean=function(n){return true===n||false===n||K(n)&&"[object Boolean]"==wn.call(n)},s.isDate=function(n){return K(n)&&"[object Date]"==wn.call(n)},s.isEmpty=function(n){return!K(n)||G(n.splice)?!z(n):!X(n).length;
},s.isEqual=function(n,t){return m(n,t)},s.isError=function(n){return K(n)&&typeof n.message=="string"&&"[object Error]"==wn.call(n)},s.isFinite=function(n){return typeof n=="number"&&kn(n)},s.isFunction=G,s.isNaN=function(n){return L(n)&&n!=+n},s.isNil=function(n){return null==n},s.isNull=function(n){return null===n},s.isNumber=L,s.isObject=H,s.isRegExp=function(n){return H(n)&&"[object RegExp]"==wn.call(n)},s.isString=Q,s.isUndefined=function(n){return n===en},s.last=function(n){var t=n?n.length:0;
return t?n[t-1]:en},s.max=function(t){return t&&t.length?n(t,tn,P,un):un},s.min=function(t){return t&&t.length?n(t,tn,W,on):on},s.noConflict=function(){return _n._=On,this},s.noop=function(){},s.now=sn,s.reduce=function(n,t,r){return e(n,d(t),r,3>arguments.length,Fn)},s.result=Z,s.size=z,s.some=function(n,t,r){return t=r?en:t,N(n,d(t))},s.uniqueId=function(n){var t=++dn;return(null==n?"":n+"")+t},rn(s,function(){var n={};return b(s,function(t,r){s.prototype[r]||(n[r]=t)}),n}(),{chain:false}),s.VERSION="3.10.1",
Fn("join pop push replace reverse shift sort splice split unshift".split(" "),function(n){var t=(/^(?:replace|split)$/.test(n)?jn:gn)[n],r=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",e=/^(?:join|pop|replace|shift)$/.test(n);s.prototype[n]=function(){var n=arguments;return e&&!this.__chain__?t.apply(this.value(),n):this[r](function(r){return t.apply(r,n)})}}),s.prototype.run=s.prototype.toJSON=s.prototype.valueOf=s.prototype.value=function(){return S(this.__wrapped__,this.__actions__)},(yn||hn||{})._=s,
typeof define=="function"&&typeof define.amd=="object"&&define.amd? define(function(){return s}):_n._=s}).call(this);