Allow _.omit and _.pick to work as a callback for _.map when combined with _.partialRight.

This commit is contained in:
John-David Dalton
2014-02-04 00:35:14 -08:00
parent 143e9bd210
commit 201d17bc31
8 changed files with 237 additions and 152 deletions

84
dist/lodash.compat.js vendored
View File

@@ -2377,8 +2377,7 @@
callback = isShallow;
isShallow = false;
// allows working with functions like `_.map` without using
// their `index` argument as a callback
// enables use as a callback for functions like `_.map`
if ((type == 'number' || type == 'string') && thisArg && thisArg[callback] === array) {
callback = null;
}
@@ -3059,8 +3058,7 @@
callback = isSorted;
isSorted = false;
// allows working with functions like `_.map` without using
// their `index` argument as a callback
// enables use as a callback for functions like `_.map`
if ((type == 'number' || type == 'string') && thisArg && thisArg[callback] === array) {
callback = null;
}
@@ -3342,8 +3340,7 @@
length = props.length,
type = typeof guard;
// allows working with functions like `_.map` without using
// their `index` arguments
// enables use as a callback for functions like `_.map`
if ((type == 'number' || type == 'string') && args[2] && args[2][guard] === collection) {
length = 1;
}
@@ -3980,8 +3977,7 @@
result = computed,
type = typeof callback;
// allows working with functions like `_.map` without using
// their `index` argument as a callback
// enables use as a callback for functions like `_.map`
if ((type == 'number' || type == 'string') && thisArg && thisArg[callback] === collection) {
callback = null;
}
@@ -4056,8 +4052,7 @@
result = computed,
type = typeof callback;
// allows working with functions like `_.map` without using
// their `index` argument as a callback
// enables use as a callback for functions like `_.map`
if ((type == 'number' || type == 'string') && thisArg && thisArg[callback] === collection) {
callback = null;
}
@@ -4247,8 +4242,7 @@
* @category Collections
* @param {Array|Object|string} collection The collection to sample.
* @param {number} [n] The number of elements to sample.
* @param- {Object} [guard] Allows working with functions like `_.map`
* without using their `index` arguments as `n`.
* @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
* @returns {*} Returns the random sample(s) of `collection`.
* @example
*
@@ -5209,8 +5203,7 @@
* return typeof a == 'undefined' ? b : a;
* });
*
* var object = { 'name': 'barney' };
* defaults(object, { 'name': 'fred', 'employer': 'slate' });
* defaults({ 'name': 'barney' }, { 'name': 'fred', 'employer': 'slate' });
* // => { 'name': 'barney', 'employer': 'slate' }
*/
function assign(object, source, guard) {
@@ -5219,8 +5212,7 @@
argsLength = args.length,
type = typeof guard;
// allows working with functions like `_.reduce` without using their
// `key` and `object` arguments as sources
// enables use as a callback for functions like `_.reduce`
if ((type == 'number' || type == 'string') && args[3] && args[3][guard] === source) {
argsLength = 2;
}
@@ -5301,8 +5293,7 @@
callback = isDeep;
isDeep = false;
// allows working with functions like `_.map` without using
// their `index` argument as a callback
// enables use as a callback for functions like `_.map`
if ((type == 'number' || type == 'string') && thisArg && thisArg[callback] === value) {
callback = null;
}
@@ -5402,13 +5393,11 @@
* @category Objects
* @param {Object} object The destination object.
* @param {...Object} [source] The source objects.
* @param- {Object} [guard] Allows working with functions like `_.reduce`
* without using their `key` and `object` arguments as sources.
* @param- {Object} [guard] Enables use as a callback for functions like `_.reduce`.
* @returns {Object} Returns the destination object.
* @example
*
* var object = { 'name': 'barney' };
* _.defaults(object, { 'name': 'fred', 'employer': 'slate' });
* _.defaults({ 'name': 'barney' }, { 'name': 'fred', 'employer': 'slate' });
* // => { 'name': 'barney', 'employer': 'slate' }
*/
function defaults(object, source, guard) {
@@ -5417,8 +5406,7 @@
argsLength = args.length,
type = typeof guard;
// allows working with functions like `_.reduce` without using their
// `key` and `object` arguments as sources
// enables use as a callback for functions like `_.reduce`
if ((type == 'number' || type == 'string') && args[3] && args[3][guard] === source) {
argsLength = 2;
}
@@ -6320,8 +6308,7 @@
length = args.length,
type = typeof guard;
// allows working with functions like `_.reduce` without using their
// `key` and `object` arguments as sources
// enables use as a callback for functions like `_.reduce`
if ((type == 'number' || type == 'string') && args[3] && args[3][guard] === source) {
length = 2;
}
@@ -6356,8 +6343,9 @@
* @memberOf _
* @category Objects
* @param {Object} object The source object.
* @param {Function|...string|string[]} [callback] The properties to omit or the
* function called per iteration.
* @param {Function|...string|string[]} [callback] The function called per
* iteration or property names to omit, specified as individual property
* names or arrays of property names.
* @param {*} [thisArg] The `this` binding of `callback`.
* @returns {Object} Returns an object without the omitted properties.
* @example
@@ -6371,16 +6359,31 @@
* // => { 'name': 'fred' }
*/
function omit(object, callback, thisArg) {
var result = {};
if (typeof callback != 'function') {
var result = {},
type = typeof callback;
if (type != 'function') {
// enables use as a callback for functions like `_.map`
// when combined with `_.partialRight`
var args = arguments;
if ((type == 'number' || type == 'string') && thisArg && thisArg[callback] === object) {
args = slice(args);
splice.call(args, 1, 2);
}
var omitProps = baseFlatten(args, true, false, 1),
length = omitProps.length;
while (length--) {
omitProps[length] = String(omitProps[length]);
}
var props = [];
baseForIn(object, function(value, key) {
props.push(key);
});
props = baseDifference(props, baseFlatten(arguments, true, false, 1));
var index = -1,
length = props.length;
var index = -1;
props = baseDifference(props, omitProps);
length = props.length;
while (++index < length) {
var key = props[index];
@@ -6452,10 +6455,19 @@
* // => { 'name': 'fred' }
*/
function pick(object, callback, thisArg) {
var result = {};
if (typeof callback != 'function') {
var result = {},
type = typeof callback;
if (type != 'function') {
// enables use as a callback for functions like `_.map`
// when combined with `_.partialRight`
var args = arguments;
if ((type == 'number' || type == 'string') && thisArg && thisArg[callback] === object) {
args = slice(args);
splice.call(args, 1, 2);
}
var index = -1,
props = baseFlatten(arguments, true, false, 1),
props = baseFlatten(args, true, false, 1),
length = isObject(object) ? props.length : 0;
while (++index < length) {

View File

@@ -47,9 +47,9 @@ return"boolean"!=u&&null!=t&&(e=r,r=t,t=false,"number"!=u&&"string"!=u||!e||e[r]
for(t=H(t,r,3);u--&&(r=e[u],false!==t(n[r],r,n)););return n},u.functions=er,u.groupBy=ve,u.indexBy=ye,u.initial=function(n,t,r){var e=0,o=n?n.length:0;if(typeof t!="number"&&null!=t){var a=o;for(t=u.createCallback(t,r,3);a--&&t(n[a],a,n);)e++}else e=null==t||r?1:t||e;return e=o-e,qt(n,0,0<e?e:0)},u.intersection=function(){for(var n=[],e=-1,u=arguments.length,o=c(),a=St(),i=ce&&a===t,l=c();++e<u;){var f=arguments[e];(de(f)||Nt(f))&&(n.push(f),o.push(i&&f.length>=S&&ce(e?n[e]:l)))}var i=n[0],p=-1,g=i?i.length:0,h=[];
n:for(;++p<g;){var v=o[0],f=i[p];if(0>(v?r(v,f):a(l,f))){for(e=u,(v||l).push(f);--e;)if(v=o[e],0>(v?r(v,f):a(n[e],f)))continue n;h.push(f)}}return s(o),s(l),h},u.invert=function(n,t){for(var r=-1,e=_e(n),u=e.length,o={};++r<u;){var a=e[r],i=n[a];t?Br.call(o,i)?o[i].push(a):o[i]=[a]:o[i]=a}return o},u.invoke=function(n,t){var r=-1,e=typeof t=="function",u=n?n.length:0,o=yr(typeof u=="number"?u:0);if(3>arguments.length&&de(n))for(;++r<u;){var a=n[r];o[r]=e?t.call(a):a[t]()}else{var i=qt(arguments,2);
ht(n,function(n){o[++r]=(e?t:n[t]).apply(n,i)})}return o},u.keys=_e,u.map=Xt,u.mapValues=function(n,t,r){var e={};return t=u.createCallback(t,r,3),dt(n,function(n,r,u){e[r]=t(n,r,u)}),e},u.match=sr,u.max=Gt,u.memoize=function(n,t){if(!or(n))throw new kr;var r=function(){var e=r.cache,u=t?t.apply(this,arguments):"_"+arguments[0];return Br.call(e,u)?e[u]:e[u]=n.apply(this,arguments)};return r.cache={},r},u.merge=function(n,t,r){if(!ar(n))return n;var e=arguments,u=e.length,o=typeof r;if("number"!=o&&"string"!=o||!e[3]||e[3][r]!==t||(u=2),3<u&&"function"==typeof e[u-2])var a=H(e[--u-1],e[u--],2);
else 2<u&&"function"==typeof e[u-1]&&(a=e[--u]);for(var e=qt(arguments,1,u),o=-1,i=c(),l=c();++o<u;)jt(n,e[o],a,i,l);return s(i),s(l),n},u.min=function(n,t,r){var o=1/0,a=o,i=typeof t;if("number"!=i&&"string"!=i||!r||r[t]!==n||(t=null),null==t&&de(n))for(r=-1,i=n.length;++r<i;){var l=n[r];l<a&&(a=l)}else t=null==t&&lr(n)?e:u.createCallback(t,r,3),ht(n,function(n,r,e){r=t(n,r,e),r<o&&(o=r,a=n)});return a},u.omit=function(n,t,r){var e={};if(typeof t!="function"){var o=[];se(n,function(n,t){o.push(t)
});for(var o=gt(o,mt(arguments,true,false,1)),a=-1,i=o.length;++a<i;){var l=o[a];e[l]=n[l]}}else t=u.createCallback(t,r,3),se(n,function(n,r,u){t(n,r,u)||(e[r]=n)});return e},u.once=function(n){var t,r;if(!or(n))throw new kr;return function(){return t?r:(t=true,r=n.apply(this,arguments),n=null,r)}},u.pairs=function(n){for(var t=-1,r=_e(n),e=r.length,u=yr(e);++t<e;){var o=r[t];u[t]=[o,n[o]]}return u},u.partial=function(n){var t=n&&(n[N]?n[N][2]:n.length),r=qt(arguments,1),t=t-r.length;return Ot(n,O,t,null,r)
},u.partialRight=function(n){var t=n&&(n[N]?n[N][2]:n.length),r=qt(arguments,1),t=t-r.length;return Ot(n,E,t,null,null,r)},u.pick=function(n,t,r){var e={};if(typeof t!="function")for(var o=-1,a=mt(arguments,true,false,1),i=ar(n)?a.length:0;++o<i;){var l=a[o];l in n&&(e[l]=n[l])}else t=u.createCallback(t,r,3),se(n,function(n,r,u){t(n,r,u)&&(e[r]=n)});return e},u.pluck=me,u.property=vr,u.pull=function(n){for(var t=arguments,r=0,e=t.length,u=n?n.length:0;++r<e;)for(var o=-1,a=t[r];++o<u;)n[o]===a&&(Mr.call(n,o--,1),u--);
else 2<u&&"function"==typeof e[u-1]&&(a=e[--u]);for(var e=qt(arguments,1,u),o=-1,i=c(),l=c();++o<u;)jt(n,e[o],a,i,l);return s(i),s(l),n},u.min=function(n,t,r){var o=1/0,a=o,i=typeof t;if("number"!=i&&"string"!=i||!r||r[t]!==n||(t=null),null==t&&de(n))for(r=-1,i=n.length;++r<i;){var l=n[r];l<a&&(a=l)}else t=null==t&&lr(n)?e:u.createCallback(t,r,3),ht(n,function(n,r,e){r=t(n,r,e),r<o&&(o=r,a=n)});return a},u.omit=function(n,t,r){var e={},o=typeof t;if("function"!=o){var a=arguments;"number"!=o&&"string"!=o||!r||r[t]!==n||(a=qt(a),Mr.call(a,1,2));
for(var i=mt(a,true,false,1),o=i.length;o--;)i[o]=Cr(i[o]);var l=[];for(se(n,function(n,t){l.push(t)}),a=-1,l=gt(l,i),o=l.length;++a<o;)i=l[a],e[i]=n[i]}else t=u.createCallback(t,r,3),se(n,function(n,r,u){t(n,r,u)||(e[r]=n)});return e},u.once=function(n){var t,r;if(!or(n))throw new kr;return function(){return t?r:(t=true,r=n.apply(this,arguments),n=null,r)}},u.pairs=function(n){for(var t=-1,r=_e(n),e=r.length,u=yr(e);++t<e;){var o=r[t];u[t]=[o,n[o]]}return u},u.partial=function(n){var t=n&&(n[N]?n[N][2]:n.length),r=qt(arguments,1),t=t-r.length;
return Ot(n,O,t,null,r)},u.partialRight=function(n){var t=n&&(n[N]?n[N][2]:n.length),r=qt(arguments,1),t=t-r.length;return Ot(n,E,t,null,null,r)},u.pick=function(n,t,r){var e={},o=typeof t;if("function"!=o){var a=arguments;"number"!=o&&"string"!=o||!r||r[t]!==n||(a=qt(a),Mr.call(a,1,2));for(var o=-1,a=mt(a,true,false,1),i=ar(n)?a.length:0;++o<i;){var l=a[o];l in n&&(e[l]=n[l])}}else t=u.createCallback(t,r,3),se(n,function(n,r,u){t(n,r,u)&&(e[r]=n)});return e},u.pluck=me,u.property=vr,u.pull=function(n){for(var t=arguments,r=0,e=t.length,u=n?n.length:0;++r<e;)for(var o=-1,a=t[r];++o<u;)n[o]===a&&(Mr.call(n,o--,1),u--);
return n},u.range=function(n,t,r){n=+n||0,r=typeof r=="number"?r:+r||1,null==t&&(t=n,n=0);var e=-1;t=Zr(0,Pr((t-n)/(r||1)));for(var u=yr(t);++e<t;)u[e]=n,n+=r;return u},u.reject=function(n,t,r){return t=u.createCallback(t,r,3),Kt(n,function(n,r,e){return!t(n,r,e)})},u.remove=function(n,t,r){var e=-1,o=n?n.length:0,a=[];for(t=u.createCallback(t,r,3);++e<o;)r=n[e],t(r,e,n)&&(a.push(r),Mr.call(n,e--,1),o--);return a},u.rest=Pt,u.shuffle=Qt,u.slice=qt,u.sortBy=function(n,t,r){var e=-1,o=t&&de(t),l=n?n.length:0,f=yr(typeof l=="number"?l:0);
for(o||(t=u.createCallback(t,r,3)),ht(n,function(n,r,u){if(o)for(u=t.length,r=yr(u);u--;)r[u]=n[t[u]];else r=t(n,r,u);u=f[++e]=J.pop()||{f:null,g:0,h:null},u.f=r,u.g=e,u.h=n}),l=f.length,f.sort(o?i:a);l--;)n=f[l],f[l]=n.h,g(n);return f},u.tap=function(n,t,r){return t.call(r,n),n},u.throttle=function(n,t,r){var e=true,u=true;if(!or(n))throw new kr;return false===r?e=false:ar(r)&&(e="leading"in r?r.leading:e,u="trailing"in r?r.trailing:u),ct.leading=e,ct.maxWait=t,ct.trailing=u,nr(n,t,ct)},u.times=function(n,t,r){n=-1<(n=+n)?n:0;
var e=-1,u=yr(n);for(t=H(t,r,1);++e<n;)u[e]=t(e);return u},u.toArray=function(n){return n&&typeof n.length=="number"?fe.unindexedChars&&lr(n)?n.split(""):qt(n):fr(n)},u.transform=function(n,t,r,e){var o=de(n);if(null==r)if(o)r=[];else{var a=n&&n.constructor;r=A(a&&a.prototype)}return t&&(t=u.createCallback(t,e,4),(o?ht:dt)(n,function(n,e,u){return t(r,n,e,u)})),r},u.union=function(){return Ct(mt(arguments,true,true))},u.uniq=$t,u.values=fr,u.where=Kt,u.without=function(n){return gt(n,qt(arguments,1))

84
dist/lodash.js vendored
View File

@@ -2114,8 +2114,7 @@
callback = isShallow;
isShallow = false;
// allows working with functions like `_.map` without using
// their `index` argument as a callback
// enables use as a callback for functions like `_.map`
if ((type == 'number' || type == 'string') && thisArg && thisArg[callback] === array) {
callback = null;
}
@@ -2796,8 +2795,7 @@
callback = isSorted;
isSorted = false;
// allows working with functions like `_.map` without using
// their `index` argument as a callback
// enables use as a callback for functions like `_.map`
if ((type == 'number' || type == 'string') && thisArg && thisArg[callback] === array) {
callback = null;
}
@@ -3079,8 +3077,7 @@
length = props.length,
type = typeof guard;
// allows working with functions like `_.map` without using
// their `index` arguments
// enables use as a callback for functions like `_.map`
if ((type == 'number' || type == 'string') && args[2] && args[2][guard] === collection) {
length = 1;
}
@@ -3718,8 +3715,7 @@
result = computed,
type = typeof callback;
// allows working with functions like `_.map` without using
// their `index` argument as a callback
// enables use as a callback for functions like `_.map`
if ((type == 'number' || type == 'string') && thisArg && thisArg[callback] === collection) {
callback = null;
}
@@ -3794,8 +3790,7 @@
result = computed,
type = typeof callback;
// allows working with functions like `_.map` without using
// their `index` argument as a callback
// enables use as a callback for functions like `_.map`
if ((type == 'number' || type == 'string') && thisArg && thisArg[callback] === collection) {
callback = null;
}
@@ -3985,8 +3980,7 @@
* @category Collections
* @param {Array|Object|string} collection The collection to sample.
* @param {number} [n] The number of elements to sample.
* @param- {Object} [guard] Allows working with functions like `_.map`
* without using their `index` arguments as `n`.
* @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
* @returns {*} Returns the random sample(s) of `collection`.
* @example
*
@@ -4943,8 +4937,7 @@
* return typeof a == 'undefined' ? b : a;
* });
*
* var object = { 'name': 'barney' };
* defaults(object, { 'name': 'fred', 'employer': 'slate' });
* defaults({ 'name': 'barney' }, { 'name': 'fred', 'employer': 'slate' });
* // => { 'name': 'barney', 'employer': 'slate' }
*/
function assign(object, source, guard) {
@@ -4953,8 +4946,7 @@
argsLength = args.length,
type = typeof guard;
// allows working with functions like `_.reduce` without using their
// `key` and `object` arguments as sources
// enables use as a callback for functions like `_.reduce`
if ((type == 'number' || type == 'string') && args[3] && args[3][guard] === source) {
argsLength = 2;
}
@@ -5035,8 +5027,7 @@
callback = isDeep;
isDeep = false;
// allows working with functions like `_.map` without using
// their `index` argument as a callback
// enables use as a callback for functions like `_.map`
if ((type == 'number' || type == 'string') && thisArg && thisArg[callback] === value) {
callback = null;
}
@@ -5136,13 +5127,11 @@
* @category Objects
* @param {Object} object The destination object.
* @param {...Object} [source] The source objects.
* @param- {Object} [guard] Allows working with functions like `_.reduce`
* without using their `key` and `object` arguments as sources.
* @param- {Object} [guard] Enables use as a callback for functions like `_.reduce`.
* @returns {Object} Returns the destination object.
* @example
*
* var object = { 'name': 'barney' };
* _.defaults(object, { 'name': 'fred', 'employer': 'slate' });
* _.defaults({ 'name': 'barney' }, { 'name': 'fred', 'employer': 'slate' });
* // => { 'name': 'barney', 'employer': 'slate' }
*/
function defaults(object, source, guard) {
@@ -5151,8 +5140,7 @@
argsLength = args.length,
type = typeof guard;
// allows working with functions like `_.reduce` without using their
// `key` and `object` arguments as sources
// enables use as a callback for functions like `_.reduce`
if ((type == 'number' || type == 'string') && args[3] && args[3][guard] === source) {
argsLength = 2;
}
@@ -6041,8 +6029,7 @@
length = args.length,
type = typeof guard;
// allows working with functions like `_.reduce` without using their
// `key` and `object` arguments as sources
// enables use as a callback for functions like `_.reduce`
if ((type == 'number' || type == 'string') && args[3] && args[3][guard] === source) {
length = 2;
}
@@ -6077,8 +6064,9 @@
* @memberOf _
* @category Objects
* @param {Object} object The source object.
* @param {Function|...string|string[]} [callback] The properties to omit or the
* function called per iteration.
* @param {Function|...string|string[]} [callback] The function called per
* iteration or property names to omit, specified as individual property
* names or arrays of property names.
* @param {*} [thisArg] The `this` binding of `callback`.
* @returns {Object} Returns an object without the omitted properties.
* @example
@@ -6092,16 +6080,31 @@
* // => { 'name': 'fred' }
*/
function omit(object, callback, thisArg) {
var result = {};
if (typeof callback != 'function') {
var result = {},
type = typeof callback;
if (type != 'function') {
// enables use as a callback for functions like `_.map`
// when combined with `_.partialRight`
var args = arguments;
if ((type == 'number' || type == 'string') && thisArg && thisArg[callback] === object) {
args = slice(args);
splice.call(args, 1, 2);
}
var omitProps = baseFlatten(args, true, false, 1),
length = omitProps.length;
while (length--) {
omitProps[length] = String(omitProps[length]);
}
var props = [];
baseForIn(object, function(value, key) {
props.push(key);
});
props = baseDifference(props, baseFlatten(arguments, true, false, 1));
var index = -1,
length = props.length;
var index = -1;
props = baseDifference(props, omitProps);
length = props.length;
while (++index < length) {
var key = props[index];
@@ -6173,10 +6176,19 @@
* // => { 'name': 'fred' }
*/
function pick(object, callback, thisArg) {
var result = {};
if (typeof callback != 'function') {
var result = {},
type = typeof callback;
if (type != 'function') {
// enables use as a callback for functions like `_.map`
// when combined with `_.partialRight`
var args = arguments;
if ((type == 'number' || type == 'string') && thisArg && thisArg[callback] === object) {
args = slice(args);
splice.call(args, 1, 2);
}
var index = -1,
props = baseFlatten(arguments, true, false, 1),
props = baseFlatten(args, true, false, 1),
length = isObject(object) ? props.length : 0;
while (++index < length) {

6
dist/lodash.min.js vendored
View File

@@ -43,9 +43,9 @@ return"boolean"!=u&&null!=t&&(e=r,r=t,t=false,"number"!=u&&"string"!=u||!e||e[r]
for(t=ct(t,r,3);u--&&(r=e[u],false!==t(n[r],r,n)););return n},y.functions=tr,y.groupBy=le,y.indexBy=ce,y.initial=function(n,t,r){var e=0,u=n?n.length:0;if(typeof t!="number"&&null!=t){var o=u;for(t=y.createCallback(t,r,3);o--&&t(n[o],o,n);)e++}else e=null==t||r?1:t||e;return e=u-e,Tt(n,0,0<e?e:0)},y.intersection=function(){for(var n=[],e=-1,u=arguments.length,o=c(),i=Ot(),a=ie&&i===t,f=c();++e<u;){var l=arguments[e];(se(l)||Et(l))&&(n.push(l),o.push(a&&l.length>=A&&ie(e?n[e]:f)))}var a=n[0],s=-1,g=a?a.length:0,h=[];
n:for(;++s<g;){var v=o[0],l=a[s];if(0>(v?r(v,l):i(f,l))){for(e=u,(v||f).push(l);--e;)if(v=o[e],0>(v?r(v,l):i(n[e],l)))continue n;h.push(l)}}return p(o),p(f),h},y.invert=function(n,t){for(var r=-1,e=he(n),u=e.length,o={};++r<u;){var i=e[r],a=n[i];t?Br.call(o,a)?o[a].push(i):o[a]=[i]:o[a]=i}return o},y.invoke=function(n,t){var r=-1,e=typeof t=="function",u=n?n.length:0,o=hr(typeof u=="number"?u:0);if(3>arguments.length&&typeof u=="number")for(;++r<u;){var i=n[r];o[r]=e?t.call(i):i[t]()}else{var a=Tt(arguments,2);
ht(n,function(n){o[++r]=(e?t:n[t]).apply(n,a)})}return o},y.keys=he,y.map=Ut,y.mapValues=function(n,t,r){var e={};return t=y.createCallback(t,r,3),bt(n,function(n,r,u){e[r]=t(n,r,u)}),e},y.match=cr,y.max=Vt,y.memoize=function(n,t){function r(){var e=r.cache,u=t?t.apply(this,arguments):"_"+arguments[0];return Br.call(e,u)?e[u]:e[u]=n.apply(this,arguments)}if(!er(n))throw new jr;return r.cache={},r},y.merge=function(n,t,r){if(!ur(n))return n;var e=arguments,u=e.length,o=typeof r;if("number"!=o&&"string"!=o||!e[3]||e[3][r]!==t||(u=2),3<u&&"function"==typeof e[u-2])var i=ct(e[--u-1],e[u--],2);
else 2<u&&"function"==typeof e[u-1]&&(i=e[--u]);for(var e=Tt(arguments,1,u),o=-1,a=c(),f=c();++o<u;)wt(n,e[o],i,a,f);return p(a),p(f),n},y.min=function(n,t,r){var u=1/0,o=u,i=typeof t;if("number"!=i&&"string"!=i||!r||r[t]!==n||(t=null),null==t&&se(n))for(r=-1,i=n.length;++r<i;){var a=n[r];a<o&&(o=a)}else t=null==t&&ir(n)?e:y.createCallback(t,r,3),ht(n,function(n,r,e){r=t(n,r,e),r<u&&(u=r,o=n)});return o},y.omit=function(n,t,r){var e={};if(typeof t!="function"){var u=[];o(n,function(n,t){u.push(t)
});for(var u=st(u,mt(arguments,true,false,1)),i=-1,a=u.length;++i<a;){var f=u[i];e[f]=n[f]}}else t=y.createCallback(t,r,3),o(n,function(n,r,u){t(n,r,u)||(e[r]=n)});return e},y.once=function(n){var t,r;if(!er(n))throw new jr;return function(){return t?r:(t=true,r=n.apply(this,arguments),n=null,r)}},y.pairs=function(n){for(var t=-1,r=he(n),e=r.length,u=hr(e);++t<e;){var o=r[t];u[t]=[o,n[o]]}return u},y.partial=function(n){var t=n&&(n[N]?n[N][2]:n.length),r=Tt(arguments,1),t=t-r.length;return Ct(n,C,t,null,r)
},y.partialRight=function(n){var t=n&&(n[N]?n[N][2]:n.length),r=Tt(arguments,1),t=t-r.length;return Ct(n,O,t,null,null,r)},y.pick=function(n,t,r){var e={};if(typeof t!="function")for(var u=-1,i=mt(arguments,true,false,1),a=ur(n)?i.length:0;++u<a;){var f=i[u];f in n&&(e[f]=n[f])}else t=y.createCallback(t,r,3),o(n,function(n,r,u){t(n,r,u)&&(e[r]=n)});return e},y.pluck=pe,y.property=gr,y.pull=function(n){for(var t=arguments,r=0,e=t.length,u=n?n.length:0;++r<e;)for(var o=-1,i=t[r];++o<u;)n[o]===i&&(zr.call(n,o--,1),u--);
else 2<u&&"function"==typeof e[u-1]&&(i=e[--u]);for(var e=Tt(arguments,1,u),o=-1,a=c(),f=c();++o<u;)wt(n,e[o],i,a,f);return p(a),p(f),n},y.min=function(n,t,r){var u=1/0,o=u,i=typeof t;if("number"!=i&&"string"!=i||!r||r[t]!==n||(t=null),null==t&&se(n))for(r=-1,i=n.length;++r<i;){var a=n[r];a<o&&(o=a)}else t=null==t&&ir(n)?e:y.createCallback(t,r,3),ht(n,function(n,r,e){r=t(n,r,e),r<u&&(u=r,o=n)});return o},y.omit=function(n,t,r){var e={},u=typeof t;if("function"!=u){var i=arguments;"number"!=u&&"string"!=u||!r||r[t]!==n||(i=Tt(i),zr.call(i,1,2));
for(var a=mt(i,true,false,1),u=a.length;u--;)a[u]=kr(a[u]);var f=[];for(o(n,function(n,t){f.push(t)}),i=-1,f=st(f,a),u=f.length;++i<u;)a=f[i],e[a]=n[a]}else t=y.createCallback(t,r,3),o(n,function(n,r,u){t(n,r,u)||(e[r]=n)});return e},y.once=function(n){var t,r;if(!er(n))throw new jr;return function(){return t?r:(t=true,r=n.apply(this,arguments),n=null,r)}},y.pairs=function(n){for(var t=-1,r=he(n),e=r.length,u=hr(e);++t<e;){var o=r[t];u[t]=[o,n[o]]}return u},y.partial=function(n){var t=n&&(n[N]?n[N][2]:n.length),r=Tt(arguments,1),t=t-r.length;
return Ct(n,C,t,null,r)},y.partialRight=function(n){var t=n&&(n[N]?n[N][2]:n.length),r=Tt(arguments,1),t=t-r.length;return Ct(n,O,t,null,null,r)},y.pick=function(n,t,r){var e={},u=typeof t;if("function"!=u){var i=arguments;"number"!=u&&"string"!=u||!r||r[t]!==n||(i=Tt(i),zr.call(i,1,2));for(var u=-1,i=mt(i,true,false,1),a=ur(n)?i.length:0;++u<a;){var f=i[u];f in n&&(e[f]=n[f])}}else t=y.createCallback(t,r,3),o(n,function(n,r,u){t(n,r,u)&&(e[r]=n)});return e},y.pluck=pe,y.property=gr,y.pull=function(n){for(var t=arguments,r=0,e=t.length,u=n?n.length:0;++r<e;)for(var o=-1,i=t[r];++o<u;)n[o]===i&&(zr.call(n,o--,1),u--);
return n},y.range=function(n,t,r){n=+n||0,r=typeof r=="number"?r:+r||1,null==t&&(t=n,n=0);var e=-1;t=Hr(0,Rr((t-n)/(r||1)));for(var u=hr(t);++e<t;)u[e]=n,n+=r;return u},y.reject=function(n,t,r){return t=y.createCallback(t,r,3),Lt(n,function(n,r,e){return!t(n,r,e)})},y.remove=function(n,t,r){var e=-1,u=n?n.length:0,o=[];for(t=y.createCallback(t,r,3);++e<u;)r=n[e],t(r,e,n)&&(o.push(r),zr.call(n,e--,1),u--);return o},y.rest=It,y.shuffle=Ht,y.slice=Tt,y.sortBy=function(n,t,r){var e=-1,u=t&&se(t),o=n?n.length:0,f=hr(typeof o=="number"?o:0);
for(u||(t=y.createCallback(t,r,3)),ht(n,function(n,r,o){if(u)for(o=t.length,r=hr(o);o--;)r[o]=n[t[o]];else r=t(n,r,o);o=f[++e]=H.pop()||{f:null,g:0,h:null},o.f=r,o.g=e,o.h=n}),o=f.length,f.sort(u?a:i);o--;)n=f[o],f[o]=n.h,s(n);return f},y.tap=function(n,t,r){return t.call(r,n),n},y.throttle=function(n,t,r){var e=true,u=true;if(!er(n))throw new jr;return false===r?e=false:ur(r)&&(e="leading"in r?r.leading:e,u="trailing"in r?r.trailing:u),at.leading=e,at.maxWait=t,at.trailing=u,Yt(n,t,at)},y.times=function(n,t,r){n=-1<(n=+n)?n:0;
var e=-1,u=hr(n);for(t=ct(t,r,1);++e<n;)u[e]=t(e);return u},y.toArray=function(n){return n&&typeof n.length=="number"?Tt(n):ar(n)},y.transform=function(n,t,r,e){var u=se(n);if(null==r)if(u)r=[];else{var o=n&&n.constructor;r=lt(o&&o.prototype)}return t&&(t=y.createCallback(t,e,4),(u?ht:bt)(n,function(n,e,u){return t(r,n,e,u)})),r},y.union=function(){return jt(mt(arguments,true,true))},y.uniq=$t,y.values=ar,y.where=Lt,y.without=function(n){return st(n,Tt(arguments,1))},y.wrap=function(n,t){return Ct(t,C,null,null,[n])

View File

@@ -1825,8 +1825,7 @@
callback = isSorted;
isSorted = false;
// allows working with functions like `_.map` without using
// their `index` argument as a callback
// enables use as a callback for functions like `_.map`
if ((type == 'number' || type == 'string') && thisArg && thisArg[callback] === array) {
callback = null;
}
@@ -2603,8 +2602,7 @@
result = computed,
type = typeof callback;
// allows working with functions like `_.map` without using
// their `index` argument as a callback
// enables use as a callback for functions like `_.map`
if ((type == 'number' || type == 'string') && thisArg && thisArg[callback] === collection) {
callback = null;
}
@@ -2677,8 +2675,7 @@
result = computed,
type = typeof callback;
// allows working with functions like `_.map` without using
// their `index` argument as a callback
// enables use as a callback for functions like `_.map`
if ((type == 'number' || type == 'string') && thisArg && thisArg[callback] === collection) {
callback = null;
}
@@ -2866,8 +2863,7 @@
* @category Collections
* @param {Array|Object|string} collection The collection to sample.
* @param {number} [n] The number of elements to sample.
* @param- {Object} [guard] Allows working with functions like `_.map`
* without using their `index` arguments as `n`.
* @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
* @returns {*} Returns the random sample(s) of `collection`.
* @example
*
@@ -3696,8 +3692,7 @@
* return typeof a == 'undefined' ? b : a;
* });
*
* var object = { 'name': 'barney' };
* defaults(object, { 'name': 'fred', 'employer': 'slate' });
* defaults({ 'name': 'barney' }, { 'name': 'fred', 'employer': 'slate' });
* // => { 'name': 'barney', 'employer': 'slate' }
*/
function assign(object, source, guard) {
@@ -3785,13 +3780,11 @@
* @category Objects
* @param {Object} object The destination object.
* @param {...Object} [source] The source objects.
* @param- {Object} [guard] Allows working with functions like `_.reduce`
* without using their `key` and `object` arguments as sources.
* @param- {Object} [guard] Enables use as a callback for functions like `_.reduce`.
* @returns {Object} Returns the destination object.
* @example
*
* var object = { 'name': 'barney' };
* _.defaults(object, { 'name': 'fred', 'employer': 'slate' });
* _.defaults({ 'name': 'barney' }, { 'name': 'fred', 'employer': 'slate' });
* // => { 'name': 'barney', 'employer': 'slate' }
*/
function defaults(object, source, guard) {
@@ -4298,8 +4291,9 @@
* @memberOf _
* @category Objects
* @param {Object} object The source object.
* @param {Function|...string|string[]} [callback] The properties to omit or the
* function called per iteration.
* @param {Function|...string|string[]} [callback] The function called per
* iteration or property names to omit, specified as individual property
* names or arrays of property names.
* @param {*} [thisArg] The `this` binding of `callback`.
* @returns {Object} Returns an object without the omitted properties.
* @example
@@ -4312,16 +4306,29 @@
* });
* // => { 'name': 'fred' }
*/
function omit(object) {
function omit(object, guard) {
var args = arguments,
result = {},
type = typeof guard;
if ((type == 'number' || type == 'string') && args[2] && args[2][guard] === object) {
args = slice(args);
splice.call(args, 1, 2);
}
var omitProps = baseFlatten(args, true, false, 1),
length = omitProps.length;
while (length--) {
omitProps[length] = String(omitProps[length]);
}
var props = [];
baseForIn(object, function(value, key) {
props.push(key);
});
props = baseDifference(props, baseFlatten(arguments, true, false, 1));
var index = -1,
length = props.length,
result = {};
var index = -1;
props = baseDifference(props, omitProps);
length = props.length;
while (++index < length) {
var key = props[index];
@@ -4384,9 +4391,16 @@
* });
* // => { 'name': 'fred' }
*/
function pick(object) {
function pick(object, guard) {
var args = arguments,
type = typeof guard;
if ((type == 'number' || type == 'string') && args[2] && args[2][guard] === object) {
args = slice(args);
splice.call(args, 1, 2);
}
var index = -1,
props = baseFlatten(arguments, true, false, 1),
props = baseFlatten(args, true, false, 1),
length = props.length,
result = {};

View File

@@ -28,13 +28,14 @@ for(var t in n)if(r(n[t],t,n)===cr)break;return n},tt=function(n){var r=[];if(!J
return function(){for(var t=r-1,e=n[t].apply(this,arguments);t--;)e=n[t].call(this,e);return e}},o.countBy=et,o.debounce=C,o.defaults=U,o.defer=function(n){if(!H(n))throw new TypeError;var r=A(arguments,1);return setTimeout(function(){n.apply(tr,r)},1)},o.delay=function(n,r){if(!H(n))throw new TypeError;var t=A(arguments,2);return setTimeout(function(){n.apply(tr,t)},r)},o.difference=function(n){return p(n,v(arguments,true,true,1))},o.filter=N,o.flatten=function(n,r,t){var e=typeof r;return"number"!=e&&"string"!=e||!t||t[r]!==n||(r=false),v(n,r)
},o.forEach=F,o.functions=V,o.groupBy=ut,o.indexBy=ot,o.initial=function(n,r,t){var e=0,u=n?n.length:0;if(typeof r!="number"&&null!=r){var o=u;for(r=X(r,t,3);o--&&r(n[o],o,n);)e++}else e=null==r||t?1:r||e;return e=u-e,A(n,0,0<e?e:0)},o.intersection=function(){for(var n=[],r=-1,t=arguments.length;++r<t;){var e=arguments[r];(ft(e)||w(e))&&n.push(e)}var u=n[0],o=-1,i=_(),f=u?u.length:0,a=[];n:for(;++o<f;)if(e=u[o],0>i(a,e)){for(r=t;--r;)if(0>i(n[r],e))continue n;a.push(e)}return a},o.invert=function(n){for(var r=-1,t=at(n),e=t.length,u={};++r<e;){var o=t[r];
u[n[o]]=o}return u},o.invoke=function(n,r){var t=-1,e=typeof r=="function",u=n?n.length:0,o=Array(typeof u=="number"?u:0);if(3>arguments.length&&typeof u=="number")for(;++t<u;){var i=n[t];o[t]=e?r.call(i):i[r]()}else{var f=A(arguments,2);s(n,function(n){o[++t]=(e?r:n[r]).apply(n,f)})}return o},o.keys=at,o.map=B,o.max=R,o.memoize=function(n,r){var t={};return function(){var e=r?r.apply(this,arguments):"_"+arguments[0];return Cr.call(t,e)?t[e]:t[e]=n.apply(this,arguments)}},o.min=function(n,r,t){var e=1/0,u=e,o=typeof r;
"number"!=o&&"string"!=o||!t||t[r]!==n||(r=null);var o=-1,i=n?n.length:0;if(null==r&&typeof i=="number")for(;++o<i;)t=n[o],t<u&&(u=t);else r=X(r,t,3),s(n,function(n,t,o){t=r(n,t,o),t<e&&(e=t,u=n)});return u},o.omit=function(n){var r=[];rt(n,function(n,t){r.push(t)});for(var r=p(r,v(arguments,true,false,1)),t=-1,e=r.length,u={};++t<e;){var o=r[t];u[o]=n[o]}return u},o.once=function(n){var r,t;if(!H(n))throw new TypeError;return function(){return r?t:(r=true,t=n.apply(this,arguments),n=null,t)}},o.pairs=function(n){for(var r=-1,t=at(n),e=t.length,u=Array(e);++r<e;){var o=t[r];
u[r]=[o,n[o]]}return u},o.partial=function(n){var r=n&&(n[lr]?n[lr][2]:n.length),t=A(arguments,1),r=r-t.length;return b(n,fr,r,null,t)},o.pick=function(n){for(var r=-1,t=v(arguments,true,false,1),e=t.length,u={};++r<e;){var o=t[r];o in n&&(u[o]=n[o])}return u},o.pluck=it,o.range=function(n,r,t){n=+n||0,t=+t||1,null==r&&(r=n,n=0);var e=-1;r=Qr(0,Dr((r-n)/t));for(var u=Array(r);++e<r;)u[e]=n,n+=t;return u},o.reject=function(n,r,t){return r=X(r,t,3),N(n,function(n,t,e){return!r(n,t,e)})},o.rest=T,o.shuffle=M,o.sortBy=function(n,t,e){var u=-1,o=n?n.length:0,i=Array(typeof o=="number"?o:0);
for(t=X(t,e,3),s(n,function(n,r,e){i[++u]={f:t(n,r,e),g:u,h:n}}),o=i.length,i.sort(r);o--;)i[o]=i[o].h;return i},o.tap=function(n,r){return r(n),n},o.throttle=function(n,r,t){var e=true,u=true;if(!H(n))throw new TypeError;return false===t?e=false:J(t)&&(e="leading"in t?t.leading:e,u="trailing"in t?t.trailing:u),t={},t.leading=e,t.maxWait=r,t.trailing=u,C(n,r,t)},o.times=function(n,r,t){n=-1<(n=+n)?n:0;var e=-1,u=Array(n);for(r=l(r,t,1);++e<n;)u[e]=r(e);return u},o.toArray=function(n){return ft(n)?A(n):n&&typeof n.length=="number"?B(n):Q(n)
},o.union=function(){return y(v(arguments,true,true))},o.uniq=O,o.values=Q,o.where=W,o.without=function(n){return p(n,A(arguments,1))},o.wrap=function(n,r){return b(r,fr,null,null,[n])},o.zip=function(){for(var n=-1,r=R(it(arguments,"length")),t=Array(0>r?0:r);++n<r;)t[n]=it(arguments,n);return t},o.collect=B,o.drop=T,o.each=F,o.extend=P,o.methods=V,o.object=function(n,r){var t=-1,e=n?n.length:0,u={};for(r||!e||ft(n[0])||(r=[]);++t<e;){var o=n[t];r?u[o]=r[t]:o&&(u[o[0]]=o[1])}return u},o.select=N,o.tail=T,o.unique=O,o.clone=function(n){return J(n)?ft(n)?A(n):P({},n):n
},o.contains=S,o.escape=function(n){return null==n?"":(n+"").replace(gr,t)},o.every=k,o.find=q,o.has=function(n,r){return n?Cr.call(n,r):false},o.identity=Y,o.indexOf=x,o.isArguments=w,o.isArray=ft,o.isBoolean=function(n){return true===n||false===n||n&&typeof n=="object"&&Ir.call(n)==br||false},o.isDate=function(n){return n&&typeof n=="object"&&Ir.call(n)==_r||false},o.isElement=function(n){return n&&1===n.nodeType||false},o.isEmpty=G,o.isEqual=function(n,r){return h(n,r)},o.isFinite=function(n){return Jr(n)&&!Kr(parseFloat(n))
},o.isFunction=H,o.isNaN=function(n){return K(n)&&n!=+n},o.isNull=function(n){return null===n},o.isNumber=K,o.isObject=J,o.isRegExp=function(n){var r=typeof n;return n&&("function"==r||"object"==r)&&Ir.call(n)==jr||false},o.isString=L,o.isUndefined=function(n){return typeof n=="undefined"},o.lastIndexOf=function(n,r,t){var e=n?n.length:0;for(typeof t=="number"&&(e=(0>t?Qr(0,e+t):Xr(t,e-1))+1);e--;)if(n[e]===r)return e;return-1},o.mixin=nr,o.noConflict=function(){return Sr._=$r,this},o.random=function(n,r){return null==n&&null==r&&(r=1),n=+n||0,null==r?(r=n,n=0):r=+r||0,n+Wr(Zr()*(r-n+1))
},o.reduce=$,o.reduceRight=I,o.result=function(n,r){if(null!=n){var t=n[r];return H(t)?n[r]():t}},o.size=function(n){var r=n?n.length:0;return typeof r=="number"?r:at(n).length},o.some=D,o.sortedIndex=E,o.template=function(n,r,t){var u=o,i=u.templateSettings;n=(n||"")+"",t=U({},t,i);var f=0,a="__p+='",i=t.variable;n.replace(RegExp((t.escape||vr).source+"|"+(t.interpolate||vr).source+"|"+(t.evaluate||vr).source+"|$","g"),function(r,t,u,o,i){return a+=n.slice(f,i).replace(hr,e),t&&(a+="'+_.escape("+t+")+'"),o&&(a+="';"+o+";\n__p+='"),u&&(a+="'+((__t=("+u+"))==null?'':__t)+'"),f=i+r.length,r
"number"!=o&&"string"!=o||!t||t[r]!==n||(r=null);var o=-1,i=n?n.length:0;if(null==r&&typeof i=="number")for(;++o<i;)t=n[o],t<u&&(u=t);else r=X(r,t,3),s(n,function(n,t,o){t=r(n,t,o),t<e&&(e=t,u=n)});return u},o.omit=function(n,r){var t=arguments,e={},u=typeof r;"number"!=u&&"string"!=u||!t[2]||t[2][r]!==n||(t=A(t),Vr.call(t,1,2));for(var o=v(t,true,false,1),t=o.length;t--;)o[t]=o[t]+"";var i=[];for(rt(n,function(n,r){i.push(r)}),u=-1,i=p(i,o),t=i.length;++u<t;)o=i[u],e[o]=n[o];return e},o.once=function(n){var r,t;
if(!H(n))throw new TypeError;return function(){return r?t:(r=true,t=n.apply(this,arguments),n=null,t)}},o.pairs=function(n){for(var r=-1,t=at(n),e=t.length,u=Array(e);++r<e;){var o=t[r];u[r]=[o,n[o]]}return u},o.partial=function(n){var r=n&&(n[lr]?n[lr][2]:n.length),t=A(arguments,1),r=r-t.length;return b(n,fr,r,null,t)},o.pick=function(n,r){var t=arguments,e=typeof r;"number"!=e&&"string"!=e||!t[2]||t[2][r]!==n||(t=A(t),Vr.call(t,1,2));for(var e=-1,t=v(t,true,false,1),u=t.length,o={};++e<u;){var i=t[e];
i in n&&(o[i]=n[i])}return o},o.pluck=it,o.range=function(n,r,t){n=+n||0,t=+t||1,null==r&&(r=n,n=0);var e=-1;r=Qr(0,Dr((r-n)/t));for(var u=Array(r);++e<r;)u[e]=n,n+=t;return u},o.reject=function(n,r,t){return r=X(r,t,3),N(n,function(n,t,e){return!r(n,t,e)})},o.rest=T,o.shuffle=M,o.sortBy=function(n,t,e){var u=-1,o=n?n.length:0,i=Array(typeof o=="number"?o:0);for(t=X(t,e,3),s(n,function(n,r,e){i[++u]={f:t(n,r,e),g:u,h:n}}),o=i.length,i.sort(r);o--;)i[o]=i[o].h;return i},o.tap=function(n,r){return r(n),n
},o.throttle=function(n,r,t){var e=true,u=true;if(!H(n))throw new TypeError;return false===t?e=false:J(t)&&(e="leading"in t?t.leading:e,u="trailing"in t?t.trailing:u),t={},t.leading=e,t.maxWait=r,t.trailing=u,C(n,r,t)},o.times=function(n,r,t){n=-1<(n=+n)?n:0;var e=-1,u=Array(n);for(r=l(r,t,1);++e<n;)u[e]=r(e);return u},o.toArray=function(n){return ft(n)?A(n):n&&typeof n.length=="number"?B(n):Q(n)},o.union=function(){return y(v(arguments,true,true))},o.uniq=O,o.values=Q,o.where=W,o.without=function(n){return p(n,A(arguments,1))
},o.wrap=function(n,r){return b(r,fr,null,null,[n])},o.zip=function(){for(var n=-1,r=R(it(arguments,"length")),t=Array(0>r?0:r);++n<r;)t[n]=it(arguments,n);return t},o.collect=B,o.drop=T,o.each=F,o.extend=P,o.methods=V,o.object=function(n,r){var t=-1,e=n?n.length:0,u={};for(r||!e||ft(n[0])||(r=[]);++t<e;){var o=n[t];r?u[o]=r[t]:o&&(u[o[0]]=o[1])}return u},o.select=N,o.tail=T,o.unique=O,o.clone=function(n){return J(n)?ft(n)?A(n):P({},n):n},o.contains=S,o.escape=function(n){return null==n?"":(n+"").replace(gr,t)
},o.every=k,o.find=q,o.has=function(n,r){return n?Cr.call(n,r):false},o.identity=Y,o.indexOf=x,o.isArguments=w,o.isArray=ft,o.isBoolean=function(n){return true===n||false===n||n&&typeof n=="object"&&Ir.call(n)==br||false},o.isDate=function(n){return n&&typeof n=="object"&&Ir.call(n)==_r||false},o.isElement=function(n){return n&&1===n.nodeType||false},o.isEmpty=G,o.isEqual=function(n,r){return h(n,r)},o.isFinite=function(n){return Jr(n)&&!Kr(parseFloat(n))},o.isFunction=H,o.isNaN=function(n){return K(n)&&n!=+n},o.isNull=function(n){return null===n
},o.isNumber=K,o.isObject=J,o.isRegExp=function(n){var r=typeof n;return n&&("function"==r||"object"==r)&&Ir.call(n)==jr||false},o.isString=L,o.isUndefined=function(n){return typeof n=="undefined"},o.lastIndexOf=function(n,r,t){var e=n?n.length:0;for(typeof t=="number"&&(e=(0>t?Qr(0,e+t):Xr(t,e-1))+1);e--;)if(n[e]===r)return e;return-1},o.mixin=nr,o.noConflict=function(){return Sr._=$r,this},o.random=function(n,r){return null==n&&null==r&&(r=1),n=+n||0,null==r?(r=n,n=0):r=+r||0,n+Wr(Zr()*(r-n+1))},o.reduce=$,o.reduceRight=I,o.result=function(n,r){if(null!=n){var t=n[r];
return H(t)?n[r]():t}},o.size=function(n){var r=n?n.length:0;return typeof r=="number"?r:at(n).length},o.some=D,o.sortedIndex=E,o.template=function(n,r,t){var u=o,i=u.templateSettings;n=(n||"")+"",t=U({},t,i);var f=0,a="__p+='",i=t.variable;n.replace(RegExp((t.escape||vr).source+"|"+(t.interpolate||vr).source+"|"+(t.evaluate||vr).source+"|$","g"),function(r,t,u,o,i){return a+=n.slice(f,i).replace(hr,e),t&&(a+="'+_.escape("+t+")+'"),o&&(a+="';"+o+";\n__p+='"),u&&(a+="'+((__t=("+u+"))==null?'':__t)+'"),f=i+r.length,r
}),a+="';",i||(i="obj",a="with("+i+"||{}){"+a+"}"),a="function("+i+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+a+"return __p}";try{var l=Function("_","return "+a)(u)}catch(c){throw c.source=a,c}return r?l(r):(l.source=a,l)},o.unescape=function(n){return null==n?"":(n+="",0>n.indexOf(";")?n:n.replace(sr,u))},o.uniqueId=function(n){var r=++pr+"";return n?n+r:r},o.all=k,o.any=D,o.detect=q,o.findWhere=function(n,r){return W(n,r,true)},o.foldl=$,o.foldr=I,o.include=S,o.inject=$,o.first=j,o.last=function(n,r,t){var e=0,u=n?n.length:0;
if(typeof r!="number"&&null!=r){var o=u;for(r=X(r,t,3);o--&&r(n[o],o,n);)e++}else if(e=r,null==e||t)return n?n[u-1]:tr;return e=u-e,A(n,0<e?e:0)},o.sample=function(n,r,t){return n&&typeof n.length!="number"&&(n=Q(n)),null==r||t?n?n[0+Wr(Zr()*(n.length-1-0+1))]:tr:(n=M(n),n.length=Xr(Qr(0,r),n.length),n)},o.take=j,o.head=j,nr(P({},o)),o.VERSION="2.4.1",o.prototype.chain=function(){return this.__chain__=true,this},o.prototype.value=function(){return this.__wrapped__},s("pop push reverse shift sort splice unshift".split(" "),function(n){var r=Br[n];
o.prototype[n]=function(){var n=this.__wrapped__;return r.apply(n,arguments),nt.spliceObjects||0!==n.length||delete n[0],this}}),s(["concat","join","slice"],function(n){var r=Br[n];o.prototype[n]=function(){var n=r.apply(this.__wrapped__,arguments);return this.__chain__&&(n=new i(n),n.__chain__=true),n}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(Sr._=o, define(function(){return o})):kr&&Nr?Fr?(Nr.exports=o)._=o:kr._=o:Sr._=o}).call(this);