diff --git a/dist/lodash.compat.js b/dist/lodash.compat.js index 171c8782f..d9d2f478b 100644 --- a/dist/lodash.compat.js +++ b/dist/lodash.compat.js @@ -249,6 +249,26 @@ return typeof objectValue == 'undefined' ? sourceValue : objectValue; } + /** + * The base implementation of `_.at` without support for strings or individual + * key arguments. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {number[]|string[]} [keys] The keys of elements to pick. + * @returns {Array} Returns the new array of picked elements. + */ + function baseAt(collection, props) { + var index = -1, + length = props.length, + result = Array(length); + + while(++index < length) { + result[index] = collection[props[index]]; + } + return result; + } + /** * The base implementation of `compareAscending` used to compare values and * sort them in ascending order without guaranteeing a stable sort. @@ -669,8 +689,8 @@ * `flatten`, `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`, * `forOwnRight`, `functions`, `groupBy`, `indexBy`, `initial`, `intersection`, * `invert`, `invoke`, `keys`, `map`, `mapValues`, `matches`, `max`, `memoize`, - * `merge`, `min`, `mixin`, `noop`, `object`, `omit`, `once`, `pairs`, - * `partial`, `partialRight`, `pick`, `pluck`, `property`, `pull`, `push`, + * `merge`, `min`, `mixin`, `noop`, `object`, `omit`, `once`, `pairs`, `partial`, + * `partialRight`, `pick`, `pluck`, `property`, `pull`, `pullAt`, `push`, * `range`, `reject`, `remove`, `rest`, `reverse`, `shuffle`, `slice`, `sort`, * `sortBy`, `splice`, `tap`, `throttle`, `times`, `toArray`, `transform`, * `union`, `uniq`, `unshift`, `unzip`, `values`, `where`, `without`, `wrap`, @@ -2932,6 +2952,47 @@ return array; } + /** + * Removes elements from `array` corresponding to the specified indexes and + * returns an array of removed elements. Indexes may be specified as an array + * of indexes or as individual arguments. + * + * Note: Unlike `_.at`, this method mutates `array`. + * + * @static + * @memberOf _ + * @category Arrays + * @param {Array} array The array to modify. + * @param {...(number|number[])} [index] The indexes of values to remove, + * specified as individual indexes or arrays of indexes. + * @returns {Array} Returns the new array of removed elements. + * @example + * + * var array = [5, 10, 15, 20]; + * var evens = _.removeAt(array, [1, 3]); + * + * console.log(array); + * // => [5, 15] + * + * console.log(evens); + * // => [10, 20] + */ + function pullAt(array) { + var indexes = baseFlatten(arguments, true, false, 1), + length = indexes.length, + result = baseAt(array, indexes); + + indexes.sort(baseCompareAscending); + while (length--) { + var index = indexes[length]; + if (index != previous) { + var previous = index; + splice.call(array, index, 1); + } + } + return result; + } + /** * Removes all elements from `array` that the predicate returns truthy for * and returns an array of removed elements. The predicate is bound to `thisArg` @@ -2954,17 +3015,17 @@ * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. - * @returns {Array} Returns the array of removed elements. + * @returns {Array} Returns the new array of removed elements. * @example * - * var array = [1, 2, 3, 4, 5, 6]; + * var array = [1, 2, 3, 4]; * var evens = _.remove(array, function(num) { return num % 2 == 0; }); * * console.log(array); - * // => [1, 3, 5] + * // => [1, 3] * * console.log(evens); - * // => [2, 4, 6] + * // => [2, 4] */ function remove(array, predicate, thisArg) { var index = -1, @@ -3592,17 +3653,17 @@ /*--------------------------------------------------------------------------*/ /** - * Creates an array of elements from the specified indexes, or keys, of the - * `collection`. Indexes may be specified as individual arguments or as arrays - * of indexes. + * Creates an array of elements corresponding to the specified keys, or indexes, + * of the collection. Keys may be specified as individual arguments or as arrays + * of keys. * * @static * @memberOf _ * @category Collections * @param {Array|Object|string} collection The collection to iterate over. - * @param {...(number|number[]|string|string[])} [index] The indexes to retrieve, - * specified as individual indexes or arrays of indexes. - * @returns {Array} Returns the array of picked elements. + * @param {...(number|number[]|string|string[])} [keys] The keys of elements + * to pick, specified as individual keys or arrays of keys. + * @returns {Array} Returns the new array of picked elements. * @example * * _.at(['a', 'b', 'c', 'd', 'e'], [0, 2, 4]); @@ -3611,25 +3672,11 @@ * _.at(['fred', 'barney', 'pebbles'], 0, 2); * // => ['fred', 'pebbles'] */ - function at(collection, guard) { - var args = arguments, - index = -1, - props = baseFlatten(args, true, false, 1), - length = props.length, - type = typeof guard; - - // enables use as a callback for functions like `_.map` - if ((type == 'number' || type == 'string') && args[2] && args[2][guard] === collection) { - length = 1; - } + function at(collection) { if (support.unindexedChars && isString(collection)) { collection = collection.split(''); } - var result = Array(length); - while(++index < length) { - result[index] = collection[props[index]]; - } - return result; + return baseAt(collection, baseFlatten(arguments, true, false, 1)); } /** @@ -4910,8 +4957,8 @@ * @memberOf _ * @category Functions * @param {Object} object The object to bind and assign the bound methods to. - * @param {...string} [methodName] The object method names to - * bind, specified as individual method names or arrays of method names. + * @param {...string} [methodNames] The object method names to bind, specified + * as individual method names or arrays of method names. * @returns {Object} Returns `object`. * @example * @@ -5526,7 +5573,7 @@ * @alias extend * @category Objects * @param {Object} object The destination object. - * @param {...Object} [source] The source objects. + * @param {...Object} [sources] The source objects. * @param {Function} [callback] The function to customize assigning values. * @param {*} [thisArg] The `this` binding of `callback`. * @returns {Object} Returns the destination object. @@ -5734,7 +5781,7 @@ * @memberOf _ * @category Objects * @param {Object} object The destination object. - * @param {...Object} [source] The source objects. + * @param {...Object} [sources] The source objects. * @param- {Object} [guard] Enables use as a callback for functions like `_.reduce`. * @returns {Object} Returns the destination object. * @example @@ -6724,7 +6771,7 @@ * @memberOf _ * @category Objects * @param {Object} object The destination object. - * @param {...Object} [source] The source objects. + * @param {...Object} [sources] The source objects. * @param {Function} [callback] The function to customize merging properties. * @param {*} [thisArg] The `this` binding of `callback`. * @returns {Object} Returns the destination object. @@ -6803,7 +6850,7 @@ * @memberOf _ * @category Objects * @param {Object} object The source object. - * @param {Function|...string|string[]} [predicate] The function called per + * @param {Function|...(string|string[])} [predicate] 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 `predicate`. @@ -6829,7 +6876,7 @@ while (length--) { omitProps[length] = String(omitProps[length]); } - return pick(object, baseDifference(keysIn(object), omitProps)); + return pick(object, baseDifference(keysIn(object), omitProps)); } /** @@ -6871,7 +6918,7 @@ * @memberOf _ * @category Objects * @param {Object} object The source object. - * @param {Function|...string|string[]} [predicate] The function called per + * @param {Function|...(string|string[])} [predicate] The function called per * iteration or property names to pick, specified as individual property * names or arrays of property names. * @param {*} [thisArg] The `this` binding of `predicate`. @@ -8338,6 +8385,7 @@ lodash.pluck = pluck; lodash.property = property; lodash.pull = pull; + lodash.pullAt = pullAt; lodash.range = range; lodash.reject = reject; lodash.remove = remove; diff --git a/dist/lodash.compat.min.js b/dist/lodash.compat.min.js index 381b63ae1..0c06c1585 100644 --- a/dist/lodash.compat.min.js +++ b/dist/lodash.compat.min.js @@ -3,67 +3,67 @@ * Lo-Dash 2.4.1 (Custom Build) lodash.com/license | Underscore.js 1.6.0 underscorejs.org/LICENSE * Build: `lodash -o ./dist/lodash.compat.js` */ -;(function(){function n(n,t){return typeof n=="undefined"?t:n}function t(n,t){if(n!==t){if(n>t||typeof n=="undefined")return 1;if(ne||13e||8202r||13r||8202>>0:0,u=Pr(e);++ri(t,l)&&f.push(l);return f}function bt(n,t){var r=-1,e=n,u=n?n.length:0;if(typeof u=="number"&&-1a(s,g)&&((u||f)&&s.push(g),c.push(p))}return c}function Nt(n,t){for(var r=-1,e=t(n),u=e.length,o=Pr(u);++ro?0:o)}function Zt(n,t,e){var u=n?n.length:0;if(typeof e=="number")e=0>e?Ce(u+e,0):e||0;else if(e)return e=Xt(n,t),u&&n[e]===t?e:-1;return r(n,t,e)}function Kt(n,t,r){var e=n?n.length:0;if(typeof t!="number"&&null!=t){var u=e,o=0;for(t=c.createCallback(t,r,3);u--&&t(n[u],u,n);)o++}else o=null==t||r?1:t;return o=e-(o||0),Jt(n,0,0>o?0:o)}function Mt(n,t,r){var e=n?n.length:0;if(typeof t!="number"&&null!=t){var u=e,o=0; -for(t=c.createCallback(t,r,3);u--&&t(n[u],u,n);)o++}else if(o=t,null==o||r)return n?n[e-1]:d;return o=e-(o||0),Jt(n,0>o?0:o)}function Vt(n,t,r){if(typeof t!="number"&&null!=t){var e=-1,u=n?n.length:0,o=0;for(t=c.createCallback(t,r,3);++et?0:t;return Jt(n,o)}function Jt(n,t,r){var e=-1,u=n?n.length:0;for(t=typeof t=="undefined"?0:+t||0,0>t?t=Ce(u+t,0):t>u&&(t=u),r=typeof r=="undefined"?u:+r||0,0>r?r=Ce(u+r,0):r>u&&(r=u),u=t>r?0:r-t,r=Pr(u);++e>>1,r(n[e])r?0:r);++tr?Ce(e+r,0):r||0:0,typeof n=="string"||!$e(n)&&kr(n)?ro&&(o=a)}else t=null==t&&kr(n)?u:c.createCallback(t,r,3),bt(n,function(n,r,u){r=t(n,r,u),(r>e||-1/0===r&&r===o)&&(e=r,o=n)});return o}function lr(n,t){return ir(n,$r(t))}function fr(n,t,r,e){var u=3>arguments.length; -if(t=c.createCallback(t,e,4),$e(n)){var o=-1,i=n.length;for(u&&i&&(r=n[++o]);++oarguments.length;return t=c.createCallback(t,e,4),_t(n,function(n,e,o){r=u?(u=false,n):t(r,n,e,o)}),r}function sr(n){var t=-1,r=n&&n.length,e=Pr(0>r?0:r>>>0);return bt(n,function(n){var r=It(0,++t);e[t]=e[r],e[r]=n}),e}function pr(n,t,r){var e;if(t=c.createCallback(t,r,3),$e(n)){r=-1;for(var u=n.length;++rarguments.length)return Ft(n,b,null,t);if(n)var r=n[O]?n[O][2]:n.length,e=Jt(arguments,2),r=r-e.length;return Ft(n,b|C,r,t,e)}function hr(n,t,r){var e,u,o,i,a,l,f,c=0,s=false,p=true;if(!wr(n))throw new Jr(E);if(t=0>t?0:t,true===r)var g=true,p=false;else xr(r)&&(g=r.leading,s="maxWait"in r&&Ce(t,+r.maxWait||0),p="trailing"in r?r.trailing:p);var h=function(){var r=t-(Ue()-i);0>=r||r>t?(u&&oe(u),r=f,u=l=f=d,r&&(c=Ue(),o=n.apply(a,e),l||u||(e=a=null))):l=ge(h,r) -},v=function(){l&&oe(l),u=l=f=d,(p||s!==t)&&(c=Ue(),o=n.apply(a,e),l||u||(e=a=null))};return function(){if(e=arguments,i=Ue(),a=this,f=p&&(l||!g),false===s)var r=g&&!l;else{u||g||(c=i);var y=s-(i-c),m=0>=y||y>s;m?(u&&(u=oe(u)),c=i,o=n.apply(a,e)):u||(u=ge(v,y))}return m&&l?l=oe(l):l||t===s||(l=ge(h,t)),r&&(m=true,o=n.apply(a,e)),!m||l||u||(e=a=null),o}}function vr(n){if(!wr(n))throw new Jr(E);return function(){return!n.apply(this,arguments)}}function yr(n,t,r){var e=arguments;if(!n||2>e.length)return n; -var u=0,o=e.length,i=typeof r;if("number"!=i&&"string"!=i||!e[3]||e[3][r]!==t||(o=2),3>>0,e=n.constructor,u=-1,o=e&&n===e.prototype,i=r-1,e=Pr(r),a=0t||null==n||!_e(t))return r;n=Vr(n);do t%2&&(r+=n),t=ie(t/2),n+=n;while(t);return r}function Rr(n,t){return(n=null==n?"":Vr(n))?null==t?n.slice(h(n),v(n)+1):(t=Vr(t),n.slice(o(n,t),i(n,t)+1)):n}function Nr(n,t,r){var e=typeof n;return"function"==e||null==n?(typeof t=="undefined"||!(n&&"prototype"in n))&&n||ht(n,t,r):"object"==e?Lr(n):$r(n)}function Tr(n){return n -}function Lr(n){var t=ze(n),r=t.length,e=t[0],u=r&&n[e];return 1!=r||u!==u||xr(u)?function(e){var u=r;if(u&&!e)return false;for(var o=true;u--&&(o=t[u],o=fe.call(e,o)&&At(e[o],n[o],null,true)););return o}:function(n){return n&&fe.call(n,e)?(n=n[e],u===n&&(0!==u||1/u==1/n)):false}}function Wr(n,t,r){var e=true,u=t&&dr(t);t&&(r||u.length)||(null==r&&(r=t),t=n,n=this,u=dr(t)),false===r?e=false:xr(r)&&"chain"in r&&(e=r.chain),r=-1;for(var o=wr(n),i=u?u.length:0;++r--n?t.apply(this,arguments):void 0}},c.assign=yr,c.at=function(n,t){var r=arguments,e=-1,u=xt(r,true,false,1),o=u.length,i=typeof t;for("number"!=i&&"string"!=i||!r[2]||r[2][t]!==n||(o=1),Ie.unindexedChars&&kr(n)&&(n=n.split("")),r=Pr(o);++earguments.length?Ft(t,b|_,null,n):Ft(t,b|_|C,null,n,Jt(arguments,2))},c.chain=function(n){return new q(n,true)},c.compact=function(n){for(var t=-1,r=n?n.length:0,e=0,u=[];++t(p?e(p,l):i(s,l))){for(t=u;--t;){var g=o[t]; -if(0>(g?e(g,l):i(n[t],l)))continue n}p&&p.push(l),s.push(l)}return s},c.invert=function(n,t){for(var r=-1,e=ze(n),u=e.length,o={};++ro?0:o>>>0);return bt(n,function(n){var o=u?t:null!=n&&n[t];i[++e]=o?o.apply(n,r):d}),i},c.keys=ze,c.keysIn=Or,c.map=ir,c.mapValues=function(n,t,r){var e={};return t=c.createCallback(t,r,3),Ot(n,function(n,r,u){e[r]=t(n,r,u) -}),e},c.matches=Lr,c.max=ar,c.memoize=function(n,t){if(!wr(n)||t&&!wr(t))throw new Jr(E);var r=function(){var e=r.cache,u=t?t.apply(this,arguments):"_"+arguments[0];return fe.call(e,u)?e[u]:e[u]=n.apply(this,arguments)};return r.cache={},r},c.merge=function(n,t,r){var e=arguments,u=e.length,o=typeof r;if(!n||2>u)return n;if("number"!=o&&"string"!=o||!e[3]||e[3][r]!==t||(u=2),3u?0:u>>>0);for(o||(t=c.createCallback(t,r,3)),bt(n,function(n,r,u){if(o)for(r=t.length,u=Pr(r);r--;)u[r]=n[t[r]]; -else u=t(n,r,u);i[++e]={a:u,b:e,c:n}}),u=i.length,i.sort(o?l:a);u--;)i[u]=i[u].c;return i},c.tap=function(n,t,r){return t.call(r,n),n},c.throttle=function(n,t,r){var e=true,u=true;if(!wr(n))throw new Jr(E);return false===r?e=false:xr(r)&&(e="leading"in r?!!r.leading:e,u="trailing"in r?!!r.trailing:u),lt.leading=e,lt.maxWait=+t,lt.trailing=u,hr(n,t,lt)},c.times=function(n,t,r){n=0>n?0:n>>>0,t=ht(t,r,1),r=-1;for(var e=Pr(n);++rr?0:+r||0,e))-t.length,0<=r&&n.indexOf(t,r)==r},c.escape=function(n){return null==n?"":Vr(n).replace(L,s)},c.escapeRegExp=Sr,c.every=tr,c.find=er,c.findIndex=qt,c.findKey=function(n,t,r){return t=c.createCallback(t,r,3),wt(n,t,Ot,true)},c.findLast=function(n,t,r){return t=c.createCallback(t,r,3),wt(n,t,_t) -},c.findLastIndex=function(n,t,r){var e=n?n.length:0;for(t=c.createCallback(t,r,3);e--;)if(t(n[e],e,n))return e;return-1},c.findLastKey=function(n,t,r){return t=c.createCallback(t,r,3),wt(n,t,Et,true)},c.findWhere=function(n,t){return er(n,Lr(t))},c.has=function(n,t){return n?fe.call(n,t):false},c.identity=Tr,c.indexOf=Zt,c.isArguments=br,c.isArray=$e,c.isBoolean=function(n){return true===n||false===n||n&&typeof n=="object"&&re.call(n)==Q||false},c.isDate=function(n){return n&&typeof n=="object"&&re.call(n)==nt||false -},c.isElement=_r,c.isEmpty=function(n){var t=true;if(!n)return t;var r=n.length;return-1r?Ce(e+r,0):je(r||0,e-1))+1);e--;)if(n[e]===t)return e;return-1},c.noConflict=function(){return t._=ne,this},c.noop=Fr,c.now=Ue,c.pad=function(n,t,r){n=null==n?"":Vr(n),t=+t;var e=n.length; -return er?0:+r||0,n.length),n.lastIndexOf(t,r)==r},c.template=function(n,t,r){var e=c.templateSettings;r=mr({},r,e),n=Vr(null==n?"":n);var u,o,i=mr({},r.imports,e.imports),e=ze(i),i=Ar(i),a=0,l=r.interpolate||U,f="__p+='",l=Mr((r.escape||U).source+"|"+l.source+"|"+(l===$?P:U).source+"|"+(r.evaluate||U).source+"|$","g"); -n.replace(l,function(t,r,e,i,l,c){return e||(e=i),f+=n.slice(a,c).replace(M,p),r&&(u=true,f+="'+__e("+r+")+'"),l&&(o=true,f+="';"+l+";\n__p+='"),e&&(f+="'+((__t=("+e+"))==null?'':__t)+'"),a=c+t.length,t}),f+="';",(r=r.variable)||(f="with(obj){"+f+"}"),f=(o?f.replace(I,""):f).replace(R,"$1").replace(N,"$1;"),f="function("+(r||"obj")+"){"+(r?"":"obj||(obj={});")+"var __t,__p=''"+(u?",__e=_.escape":"")+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+f+"return __p}";try{var s=qr(e,"return "+f).apply(d,i) -}catch(g){throw g.source=f,g}return t?s(t):(s.source=f,s)},c.trim=Rr,c.trimLeft=function(n,t){return(n=null==n?"":Vr(n))?null==t?n.slice(h(n)):(t=Vr(t),n.slice(o(n,t))):n},c.trimRight=function(n,t){return(n=null==n?"":Vr(n))?null==t?n.slice(0,v(n)+1):(t=Vr(t),n.slice(0,i(n,t)+1)):n},c.truncate=function(n,t){var r=30,e="...";if(t&&xr(t))var u="separator"in t?t.separator:u,r="length"in t?+t.length||0:r,e="omission"in t?Vr(t.omission):e;else null!=t&&(r=+t||0);if(n=null==n?"":Vr(n),r>=n.length)return n; -var o=r-e.length;if(1>o)return e;if(r=n.slice(0,o),null==u)return r+e;if(jr(u)){if(n.slice(o).search(u)){var i,a,l=n.slice(0,o);for(u.global||(u=Mr(u.source,(z.exec(u)||"")+"g")),u.lastIndex=0;i=u.exec(l);)a=i.index;r=r.slice(0,null==a?o:a)}}else n.indexOf(u,o)!=o&&(u=r.lastIndexOf(u),-1n.indexOf(";")?n:n.replace(T,y))},c.uniqueId=function(n){var t=++A;return Vr(null==n?"":n)+t},c.all=tr,c.any=pr,c.detect=er,c.foldl=fr,c.foldr=cr,c.include=nr,c.inject=fr,Wr(c,function(){var n={}; -return Ot(c,function(t,r){c.prototype[r]||(n[r]=t)}),n}(),false),c.first=Ut,c.last=Mt,c.sample=function(n,t,r){return n&&typeof n.length!="number"?n=Ar(n):Ie.unindexedChars&&kr(n)&&(n=n.split("")),null==t||r?(t=n?n.length:0,0t?0:+t||0,n.length),n)},c.take=Ut,c.takeRight=Mt,c.takeRightWhile=Mt,c.takeWhile=Ut,c.head=Ut,Ot(c,function(n,t){var r="sample"!==t;c.prototype[t]||(c.prototype[t]=function(t,e){var u=this.__chain__,o=n(this.__wrapped__,t,e);return u||null!=t&&(!e||r&&typeof t=="function")?new q(o,u):o -})}),c.VERSION=k,c.prototype.chain=function(){return this.__chain__=true,this},c.prototype.toJSON=Qt,c.prototype.toString=function(){return Vr(this.__wrapped__)},c.prototype.value=Qt,c.prototype.valueOf=Qt,V(["join","pop","shift"],function(n){var t=Xr[n];c.prototype[n]=function(){var n=this.__chain__,r=t.apply(this.__wrapped__,arguments);return n?new q(r,n):r}}),V(["push","reverse","sort","unshift"],function(n){var t=Xr[n];c.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),V(["concat","splice"],function(n){var t=Xr[n]; -c.prototype[n]=function(){return new q(t.apply(this.__wrapped__,arguments),this.__chain__)}}),Ie.spliceObjects||V(["pop","shift","splice"],function(n){var t=Xr[n],r="splice"==n;c.prototype[n]=function(){var n=this.__chain__,e=this.__wrapped__,u=t.apply(e,arguments);return 0===e.length&&delete e[0],n||r?new q(u,n):u}}),c}var d,b=1,_=2,w=4,x=8,C=16,j=32,k="2.4.1",O="__lodash@"+k+"__",E="Expected a function",A=0,S=/^[A-Z]+$/,I=/\b__p\+='';/g,R=/\b(__p\+=)''\+/g,N=/(__e\(.*?\)|\b__t\))\+'';/g,T=/&(?:amp|lt|gt|quot|#39);/g,L=/[&<>"']/g,W=/<%-([\s\S]+?)%>/g,F=/<%([\s\S]+?)%>/g,$=/<%=([\s\S]+?)%>/g,P=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,z=/\w*$/,D=/^\s*function[ \n\r\t]+\w/,B=/^0[xX]/,q=/[\xC0-\xFF]/g,U=/($^)/,Z=/[.*+?^${}()|[\]\/\\]/g,K=/\bthis\b/,M=/['\n\r\u2028\u2029\\]/g,V=/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[a-z]+|[0-9]+/g,J=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",X="Array Boolean Date Error Function Math Number Object RegExp Set String _ clearTimeout document isFinite isNaN parseInt setTimeout TypeError window WinRTError".split(" "),Y="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),G="[object Arguments]",H="[object Array]",Q="[object Boolean]",nt="[object Date]",tt="[object Error]",rt="[object Function]",et="[object Number]",ut="[object Object]",ot="[object RegExp]",it="[object String]",at={}; -at[rt]=false,at[G]=at[H]=at[Q]=at[nt]=at[et]=at[ut]=at[ot]=at[it]=true;var lt={leading:false,maxWait:0,trailing:false},ft={configurable:false,enumerable:false,value:null,writable:false},ct={"&":"&","<":"<",">":">",'"':""","'":"'"},st={"&":"&","<":"<",">":">",""":'"',"'":"'"},pt={\u00c0:"A",\u00c1:"A",\u00c2:"A",\u00c3:"A",\u00c4:"A",\u00c5:"A",\u00e0:"a",\u00e1:"a",\u00e2:"a",\u00e3:"a",\u00e4:"a",\u00e5:"a",\u00c7:"C",\u00e7:"c",\u00d0:"D",\u00f0:"d",\u00c8:"E",\u00c9:"E",\u00ca:"E",\u00cb:"E",\u00e8:"e",\u00e9:"e",\u00ea:"e",\u00eb:"e",\u00cc:"I",\u00cd:"I",\u00ce:"I",\u00cf:"I",\u00ec:"i",\u00ed:"i",\u00ee:"i",\u00ef:"i",\u00d1:"N",\u00f1:"n",\u00d2:"O",\u00d3:"O",\u00d4:"O",\u00d5:"O",\u00d6:"O",\u00d8:"O",\u00f2:"o",\u00f3:"o",\u00f4:"o",\u00f5:"o",\u00f6:"o",\u00f8:"o",\u00d9:"U",\u00da:"U",\u00db:"U",\u00dc:"U",\u00f9:"u",\u00fa:"u",\u00fb:"u",\u00fc:"u",\u00dd:"Y",\u00fd:"y",\u00ff:"y",\u00c6:"AE",\u00e6:"ae",\u00de:"Th",\u00fe:"th",\u00df:"ss","\xd7":" ","\xf7":" "},gt={"function":true,object:true},ht={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},vt=gt[typeof window]&&window||this,yt=gt[typeof exports]&&exports&&!exports.nodeType&&exports,gt=gt[typeof module]&&module&&!module.nodeType&&module,mt=yt&>&&typeof global=="object"&&global; -!mt||mt.global!==mt&&mt.window!==mt&&mt.self!==mt||(vt=mt);var mt=gt&>.exports===yt&&yt,dt=m();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(vt._=dt, define(function(){return dt})):yt&>?mt?(gt.exports=dt)._=dt:yt._=dt:vt._=dt}).call(this); \ No newline at end of file +;(function(){function n(n,t){return typeof n=="undefined"?t:n}function t(n,t){for(var r=-1,e=t.length,u=Array(e);++rt||typeof n=="undefined")return 1;if(ne||13e||8202r||13r||8202>>0:0,u=Dr(e);++ri(t,l)&&f.push(l);return f}function wt(n,t){var r=-1,e=n,u=n?n.length:0;if(typeof u=="number"&&-1a(s,g)&&((r||f)&&s.push(g),c.push(p))}return c}function Lt(n,t){for(var r=-1,e=t(n),u=e.length,o=Dr(u);++ro?0:o)}function Mt(n,t,r){var u=n?n.length:0;if(typeof r=="number")r=0>r?ke(u+r,0):r||0;else if(r)return r=Gt(n,t),u&&n[r]===t?r:-1;return e(n,t,r)}function Vt(n,t,r){var e=n?n.length:0;if(typeof t!="number"&&null!=t){var u=e,o=0;for(t=U.createCallback(t,r,3);u--&&t(n[u],u,n);)o++}else o=null==t||r?1:t;return o=e-(o||0),Yt(n,0,0>o?0:o)}function Jt(n,t,r){var e=n?n.length:0;if(typeof t!="number"&&null!=t){var u=e,o=0; +for(t=U.createCallback(t,r,3);u--&&t(n[u],u,n);)o++}else if(o=t,null==o||r)return n?n[e-1]:b;return o=e-(o||0),Yt(n,0>o?0:o)}function Xt(n,t,r){if(typeof t!="number"&&null!=t){var e=-1,u=n?n.length:0,o=0;for(t=U.createCallback(t,r,3);++et?0:t;return Yt(n,o)}function Yt(n,t,r){var e=-1,u=n?n.length:0;for(t=typeof t=="undefined"?0:+t||0,0>t?t=ke(u+t,0):t>u&&(t=u),r=typeof r=="undefined"?u:+r||0,0>r?r=ke(u+r,0):r>u&&(r=u),u=t>r?0:r-t,r=Dr(u);++e>>1,r(n[e])r?0:r);++tr?ke(e+r,0):r||0:0,typeof n=="string"||!ze(n)&&Er(n)?ru&&(u=a)}else t=null==t&&Er(n)?o:U.createCallback(t,r,3),wt(n,function(n,r,o){r=t(n,r,o),(r>e||-1/0===r&&r===u)&&(e=r,u=n)});return u}function cr(n,t){return lr(n,zr(t))}function sr(n,t,r,e){var u=3>arguments.length; +if(t=U.createCallback(t,e,4),ze(n)){var o=-1,i=n.length;for(u&&i&&(r=n[++o]);++oarguments.length;return t=U.createCallback(t,e,4),xt(n,function(n,e,o){r=u?(u=false,n):t(r,n,e,o)}),r}function gr(n){var t=-1,r=n&&n.length,e=Dr(0>r?0:r>>>0);return wt(n,function(n){var r=Nt(0,++t);e[t]=e[r],e[r]=n}),e}function hr(n,t,r){var e;if(t=U.createCallback(t,r,3),ze(n)){r=-1;for(var u=n.length;++rarguments.length)return Pt(n,_,null,t);if(n)var r=n[E]?n[E][2]:n.length,e=Yt(arguments,2),r=r-e.length;return Pt(n,_|j,r,t,e)}function yr(n,t,r){var e,u,o,i,a,l,f,c=0,s=false,p=true;if(!Cr(n))throw new Yr(A);if(t=0>t?0:t,true===r)var g=true,p=false;else jr(r)&&(g=r.leading,s="maxWait"in r&&ke(t,+r.maxWait||0),p="trailing"in r?r.trailing:p);var h=function(){var r=t-(Ke()-i);0>=r||r>t?(u&&ae(u),r=f,u=l=f=b,r&&(c=Ke(),o=n.apply(a,e),l||u||(e=a=null))):l=ve(h,r) +},v=function(){l&&ae(l),u=l=f=b,(p||s!==t)&&(c=Ke(),o=n.apply(a,e),l||u||(e=a=null))};return function(){if(e=arguments,i=Ke(),a=this,f=p&&(l||!g),false===s)var r=g&&!l;else{u||g||(c=i);var y=s-(i-c),m=0>=y||y>s;m?(u&&(u=ae(u)),c=i,o=n.apply(a,e)):u||(u=ve(v,y))}return m&&l?l=ae(l):l||t===s||(l=ve(h,t)),r&&(m=true,o=n.apply(a,e)),!m||l||u||(e=a=null),o}}function mr(n){if(!Cr(n))throw new Yr(A);return function(){return!n.apply(this,arguments)}}function dr(n,t,r){var e=arguments;if(!n||2>e.length)return n; +var u=0,o=e.length,i=typeof r;if("number"!=i&&"string"!=i||!e[3]||e[3][r]!==t||(o=2),3>>0,e=n.constructor,u=-1,o=e&&n===e.prototype,i=r-1,e=Dr(r),a=0t||null==n||!xe(t))return r;n=Xr(n);do t%2&&(r+=n),t=le(t/2),n+=n;while(t);return r}function Tr(n,t){return(n=null==n?"":Xr(n))?null==t?n.slice(v(n),y(n)+1):(t=Xr(t),n.slice(i(n,t),a(n,t)+1)):n}function Lr(n,t,r){var e=typeof n;return"function"==e||null==n?(typeof t=="undefined"||!(n&&"prototype"in n))&&n||mt(n,t,r):"object"==e?Fr(n):zr(n)}function Wr(n){return n +}function Fr(n){var t=Be(n),r=t.length,e=t[0],u=r&&n[e];return 1!=r||u!==u||jr(u)?function(e){var u=r;if(u&&!e)return false;for(var o=true;u--&&(o=t[u],o=se.call(e,o)&&It(e[o],n[o],null,true)););return o}:function(n){return n&&se.call(n,e)?(n=n[e],u===n&&(0!==u||1/u==1/n)):false}}function $r(n,t,r){var e=true,u=t&&_r(t);t&&(r||u.length)||(null==r&&(r=t),t=n,n=this,u=_r(t)),false===r?e=false:jr(r)&&"chain"in r&&(e=r.chain),r=-1;for(var o=Cr(n),i=u?u.length:0;++r--n?t.apply(this,arguments):void 0}},U.assign=dr,U.at=function(n){return Ne.unindexedChars&&Er(n)&&(n=n.split("")),t(n,jt(arguments,true,false,1))},U.bind=vr,U.bindAll=function(n){for(var t=1arguments.length?Pt(t,_|w,null,n):Pt(t,_|w|j,null,n,Yt(arguments,2))},U.chain=function(n){return new J(n,true)},U.compact=function(n){for(var t=-1,r=n?n.length:0,e=0,u=[];++t(p?u(p,l):i(s,l))){for(t=r;--t;){var g=o[t];if(0>(g?u(g,l):i(n[t],l)))continue n}p&&p.push(l),s.push(l)}return s},U.invert=function(n,t){for(var r=-1,e=Be(n),u=e.length,o={};++ro?0:o>>>0);return wt(n,function(n){var o=u?t:null!=n&&n[t];i[++e]=o?o.apply(n,r):b}),i},U.keys=Be,U.keysIn=Ar,U.map=lr,U.mapValues=function(n,t,r){var e={};return t=U.createCallback(t,r,3),At(n,function(n,r,u){e[r]=t(n,r,u)}),e},U.matches=Fr,U.max=fr,U.memoize=function(n,t){if(!Cr(n)||t&&!Cr(t))throw new Yr(A);var r=function(){var e=r.cache,u=t?t.apply(this,arguments):"_"+arguments[0]; +return se.call(e,u)?e[u]:e[u]=n.apply(this,arguments)};return r.cache={},r},U.merge=function(n,t,r){var e=arguments,u=e.length,o=typeof r;if(!n||2>u)return n;if("number"!=o&&"string"!=o||!e[3]||e[3][r]!==t||(u=2),3u?0:u>>>0); +for(o||(t=U.createCallback(t,r,3)),wt(n,function(n,r,u){if(o)for(r=t.length,u=Dr(r);r--;)u[r]=n[t[r]];else u=t(n,r,u);i[++e]={a:u,b:e,c:n}}),u=i.length,i.sort(o?f:l);u--;)i[u]=i[u].c;return i},U.tap=function(n,t,r){return t.call(r,n),n},U.throttle=function(n,t,r){var e=true,u=true;if(!Cr(n))throw new Yr(A);return false===r?e=false:jr(r)&&(e="leading"in r?!!r.leading:e,u="trailing"in r?!!r.trailing:u),ft.leading=e,ft.maxWait=+t,ft.trailing=u,yr(n,t,ft)},U.times=function(n,t,r){n=0>n?0:n>>>0,t=mt(t,r,1),r=-1; +for(var e=Dr(n);++rr?0:+r||0,e))-t.length,0<=r&&n.indexOf(t,r)==r},U.escape=function(n){return null==n?"":Xr(n).replace(W,p)},U.escapeRegExp=Rr,U.every=er,U.find=or,U.findIndex=Zt,U.findKey=function(n,t,r){return t=U.createCallback(t,r,3),Ct(n,t,At,true) +},U.findLast=function(n,t,r){return t=U.createCallback(t,r,3),Ct(n,t,xt)},U.findLastIndex=function(n,t,r){var e=n?n.length:0;for(t=U.createCallback(t,r,3);e--;)if(t(n[e],e,n))return e;return-1},U.findLastKey=function(n,t,r){return t=U.createCallback(t,r,3),Ct(n,t,St,true)},U.findWhere=function(n,t){return or(n,Fr(t))},U.has=function(n,t){return n?se.call(n,t):false},U.identity=Wr,U.indexOf=Mt,U.isArguments=wr,U.isArray=ze,U.isBoolean=function(n){return true===n||false===n||n&&typeof n=="object"&&ue.call(n)==nt||false +},U.isDate=function(n){return n&&typeof n=="object"&&ue.call(n)==tt||false},U.isElement=xr,U.isEmpty=function(n){var t=true;if(!n)return t;var r=n.length;return-1r?ke(e+r,0):Oe(r||0,e-1))+1);e--;)if(n[e]===t)return e;return-1},U.noConflict=function(){return s._=re,this},U.noop=Pr,U.now=Ke,U.pad=function(n,t,r){n=null==n?"":Xr(n),t=+t; +var e=n.length;return er?0:+r||0,n.length),n.lastIndexOf(t,r)==r},U.template=function(n,t,r){var e=U.templateSettings;r=br({},r,e),n=Xr(null==n?"":n);var u,o,i=br({},r.imports,e.imports),e=Be(i),i=Ir(i),a=0,l=r.interpolate||Z,f="__p+='",l=Jr((r.escape||Z).source+"|"+l.source+"|"+(l===P?z:Z).source+"|"+(r.evaluate||Z).source+"|$","g"); +n.replace(l,function(t,r,e,i,l,c){return e||(e=i),f+=n.slice(a,c).replace(V,g),r&&(u=true,f+="'+__e("+r+")+'"),l&&(o=true,f+="';"+l+";\n__p+='"),e&&(f+="'+((__t=("+e+"))==null?'':__t)+'"),a=c+t.length,t}),f+="';",(r=r.variable)||(f="with(obj){"+f+"}"),f=(o?f.replace(R,""):f).replace(N,"$1").replace(T,"$1;"),f="function("+(r||"obj")+"){"+(r?"":"obj||(obj={});")+"var __t,__p=''"+(u?",__e=_.escape":"")+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+f+"return __p}";try{var c=Zr(e,"return "+f).apply(b,i) +}catch(s){throw s.source=f,s}return t?c(t):(c.source=f,c)},U.trim=Tr,U.trimLeft=function(n,t){return(n=null==n?"":Xr(n))?null==t?n.slice(v(n)):(t=Xr(t),n.slice(i(n,t))):n},U.trimRight=function(n,t){return(n=null==n?"":Xr(n))?null==t?n.slice(0,y(n)+1):(t=Xr(t),n.slice(0,a(n,t)+1)):n},U.truncate=function(n,t){var r=30,e="...";if(t&&jr(t))var u="separator"in t?t.separator:u,r="length"in t?+t.length||0:r,e="omission"in t?Xr(t.omission):e;else null!=t&&(r=+t||0);if(n=null==n?"":Xr(n),r>=n.length)return n; +var o=r-e.length;if(1>o)return e;if(r=n.slice(0,o),null==u)return r+e;if(Or(u)){if(n.slice(o).search(u)){var i,a,l=n.slice(0,o);for(u.global||(u=Jr(u.source,(D.exec(u)||"")+"g")),u.lastIndex=0;i=u.exec(l);)a=i.index;r=r.slice(0,null==a?o:a)}}else n.indexOf(u,o)!=o&&(u=r.lastIndexOf(u),-1n.indexOf(";")?n:n.replace(L,m))},U.uniqueId=function(n){var t=++S;return Xr(null==n?"":n)+t},U.all=er,U.any=hr,U.detect=or,U.foldl=sr,U.foldr=pr,U.include=rr,U.inject=sr,$r(U,function(){var n={}; +return At(U,function(t,r){U.prototype[r]||(n[r]=t)}),n}(),false),U.first=Kt,U.last=Jt,U.sample=function(n,t,r){return n&&typeof n.length!="number"?n=Ir(n):Ne.unindexedChars&&Er(n)&&(n=n.split("")),null==t||r?(t=n?n.length:0,0t?0:+t||0,n.length),n)},U.take=Kt,U.takeRight=Jt,U.takeRightWhile=Jt,U.takeWhile=Kt,U.head=Kt,At(U,function(n,t){var r="sample"!==t;U.prototype[t]||(U.prototype[t]=function(t,e){var u=this.__chain__,o=n(this.__wrapped__,t,e);return u||null!=t&&(!e||r&&typeof t=="function")?new J(o,u):o +})}),U.VERSION=O,U.prototype.chain=function(){return this.__chain__=true,this},U.prototype.toJSON=tr,U.prototype.toString=function(){return Xr(this.__wrapped__)},U.prototype.value=tr,U.prototype.valueOf=tr,st(["join","pop","shift"],function(n){var t=Gr[n];U.prototype[n]=function(){var n=this.__chain__,r=t.apply(this.__wrapped__,arguments);return n?new J(r,n):r}}),st(["push","reverse","sort","unshift"],function(n){var t=Gr[n];U.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this} +}),st(["concat","splice"],function(n){var t=Gr[n];U.prototype[n]=function(){return new J(t.apply(this.__wrapped__,arguments),this.__chain__)}}),Ne.spliceObjects||st(["pop","shift","splice"],function(n){var t=Gr[n],r="splice"==n;U.prototype[n]=function(){var n=this.__chain__,e=this.__wrapped__,u=t.apply(e,arguments);return 0===e.length&&delete e[0],n||r?new J(u,n):u}}),U}var b,_=1,w=2,x=4,C=8,j=16,k=32,O="2.4.1",E="__lodash@"+O+"__",A="Expected a function",S=0,I=/^[A-Z]+$/,R=/\b__p\+='';/g,N=/\b(__p\+=)''\+/g,T=/(__e\(.*?\)|\b__t\))\+'';/g,L=/&(?:amp|lt|gt|quot|#39);/g,W=/[&<>"']/g,F=/<%-([\s\S]+?)%>/g,$=/<%([\s\S]+?)%>/g,P=/<%=([\s\S]+?)%>/g,z=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,D=/\w*$/,B=/^\s*function[ \n\r\t]+\w/,q=/^0[xX]/,U=/[\xC0-\xFF]/g,Z=/($^)/,K=/[.*+?^${}()|[\]\/\\]/g,M=/\bthis\b/,V=/['\n\r\u2028\u2029\\]/g,J=/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[a-z]+|[0-9]+/g,X=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",Y="Array Boolean Date Error Function Math Number Object RegExp Set String _ clearTimeout document isFinite isNaN parseInt setTimeout TypeError window WinRTError".split(" "),G="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),H="[object Arguments]",Q="[object Array]",nt="[object Boolean]",tt="[object Date]",rt="[object Error]",et="[object Function]",ut="[object Number]",ot="[object Object]",it="[object RegExp]",at="[object String]",lt={}; +lt[et]=false,lt[H]=lt[Q]=lt[nt]=lt[tt]=lt[ut]=lt[ot]=lt[it]=lt[at]=true;var ft={leading:false,maxWait:0,trailing:false},ct={configurable:false,enumerable:false,value:null,writable:false},st={"&":"&","<":"<",">":">",'"':""","'":"'"},pt={"&":"&","<":"<",">":">",""":'"',"'":"'"},gt={\u00c0:"A",\u00c1:"A",\u00c2:"A",\u00c3:"A",\u00c4:"A",\u00c5:"A",\u00e0:"a",\u00e1:"a",\u00e2:"a",\u00e3:"a",\u00e4:"a",\u00e5:"a",\u00c7:"C",\u00e7:"c",\u00d0:"D",\u00f0:"d",\u00c8:"E",\u00c9:"E",\u00ca:"E",\u00cb:"E",\u00e8:"e",\u00e9:"e",\u00ea:"e",\u00eb:"e",\u00cc:"I",\u00cd:"I",\u00ce:"I",\u00cf:"I",\u00ec:"i",\u00ed:"i",\u00ee:"i",\u00ef:"i",\u00d1:"N",\u00f1:"n",\u00d2:"O",\u00d3:"O",\u00d4:"O",\u00d5:"O",\u00d6:"O",\u00d8:"O",\u00f2:"o",\u00f3:"o",\u00f4:"o",\u00f5:"o",\u00f6:"o",\u00f8:"o",\u00d9:"U",\u00da:"U",\u00db:"U",\u00dc:"U",\u00f9:"u",\u00fa:"u",\u00fb:"u",\u00fc:"u",\u00dd:"Y",\u00fd:"y",\u00ff:"y",\u00c6:"AE",\u00e6:"ae",\u00de:"Th",\u00fe:"th",\u00df:"ss","\xd7":" ","\xf7":" "},ht={"function":true,object:true},vt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},yt=ht[typeof window]&&window||this,mt=ht[typeof exports]&&exports&&!exports.nodeType&&exports,ht=ht[typeof module]&&module&&!module.nodeType&&module,dt=mt&&ht&&typeof global=="object"&&global; +!dt||dt.global!==dt&&dt.window!==dt&&dt.self!==dt||(yt=dt);var dt=ht&&ht.exports===mt&&mt,bt=d();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(yt._=bt, define(function(){return bt})):mt&&ht?dt?(ht.exports=bt)._=bt:mt._=bt:yt._=bt}).call(this); \ No newline at end of file diff --git a/dist/lodash.js b/dist/lodash.js index 4c73927e7..eb914d1a4 100644 --- a/dist/lodash.js +++ b/dist/lodash.js @@ -243,6 +243,26 @@ return typeof objectValue == 'undefined' ? sourceValue : objectValue; } + /** + * The base implementation of `_.at` without support for strings or individual + * key arguments. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {number[]|string[]} [keys] The keys of elements to pick. + * @returns {Array} Returns the new array of picked elements. + */ + function baseAt(collection, props) { + var index = -1, + length = props.length, + result = Array(length); + + while(++index < length) { + result[index] = collection[props[index]]; + } + return result; + } + /** * The base implementation of `compareAscending` used to compare values and * sort them in ascending order without guaranteeing a stable sort. @@ -629,8 +649,8 @@ * `flatten`, `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`, * `forOwnRight`, `functions`, `groupBy`, `indexBy`, `initial`, `intersection`, * `invert`, `invoke`, `keys`, `map`, `mapValues`, `matches`, `max`, `memoize`, - * `merge`, `min`, `mixin`, `noop`, `object`, `omit`, `once`, `pairs`, - * `partial`, `partialRight`, `pick`, `pluck`, `property`, `pull`, `push`, + * `merge`, `min`, `mixin`, `noop`, `object`, `omit`, `once`, `pairs`, `partial`, + * `partialRight`, `pick`, `pluck`, `property`, `pull`, `pullAt`, `push`, * `range`, `reject`, `remove`, `rest`, `reverse`, `shuffle`, `slice`, `sort`, * `sortBy`, `splice`, `tap`, `throttle`, `times`, `toArray`, `transform`, * `union`, `uniq`, `unshift`, `unzip`, `values`, `where`, `without`, `wrap`, @@ -2751,6 +2771,47 @@ return array; } + /** + * Removes elements from `array` corresponding to the specified indexes and + * returns an array of removed elements. Indexes may be specified as an array + * of indexes or as individual arguments. + * + * Note: Unlike `_.at`, this method mutates `array`. + * + * @static + * @memberOf _ + * @category Arrays + * @param {Array} array The array to modify. + * @param {...(number|number[])} [index] The indexes of values to remove, + * specified as individual indexes or arrays of indexes. + * @returns {Array} Returns the new array of removed elements. + * @example + * + * var array = [5, 10, 15, 20]; + * var evens = _.removeAt(array, [1, 3]); + * + * console.log(array); + * // => [5, 15] + * + * console.log(evens); + * // => [10, 20] + */ + function pullAt(array) { + var indexes = baseFlatten(arguments, true, false, 1), + length = indexes.length, + result = baseAt(array, indexes); + + indexes.sort(baseCompareAscending); + while (length--) { + var index = indexes[length]; + if (index != previous) { + var previous = index; + splice.call(array, index, 1); + } + } + return result; + } + /** * Removes all elements from `array` that the predicate returns truthy for * and returns an array of removed elements. The predicate is bound to `thisArg` @@ -2773,17 +2834,17 @@ * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. - * @returns {Array} Returns the array of removed elements. + * @returns {Array} Returns the new array of removed elements. * @example * - * var array = [1, 2, 3, 4, 5, 6]; + * var array = [1, 2, 3, 4]; * var evens = _.remove(array, function(num) { return num % 2 == 0; }); * * console.log(array); - * // => [1, 3, 5] + * // => [1, 3] * * console.log(evens); - * // => [2, 4, 6] + * // => [2, 4] */ function remove(array, predicate, thisArg) { var index = -1, @@ -3411,17 +3472,17 @@ /*--------------------------------------------------------------------------*/ /** - * Creates an array of elements from the specified indexes, or keys, of the - * `collection`. Indexes may be specified as individual arguments or as arrays - * of indexes. + * Creates an array of elements corresponding to the specified keys, or indexes, + * of the collection. Keys may be specified as individual arguments or as arrays + * of keys. * * @static * @memberOf _ * @category Collections * @param {Array|Object|string} collection The collection to iterate over. - * @param {...(number|number[]|string|string[])} [index] The indexes to retrieve, - * specified as individual indexes or arrays of indexes. - * @returns {Array} Returns the array of picked elements. + * @param {...(number|number[]|string|string[])} [keys] The keys of elements + * to pick, specified as individual keys or arrays of keys. + * @returns {Array} Returns the new array of picked elements. * @example * * _.at(['a', 'b', 'c', 'd', 'e'], [0, 2, 4]); @@ -3430,22 +3491,8 @@ * _.at(['fred', 'barney', 'pebbles'], 0, 2); * // => ['fred', 'pebbles'] */ - function at(collection, guard) { - var args = arguments, - index = -1, - props = baseFlatten(args, true, false, 1), - length = props.length, - type = typeof guard; - - // enables use as a callback for functions like `_.map` - if ((type == 'number' || type == 'string') && args[2] && args[2][guard] === collection) { - length = 1; - } - var result = Array(length); - while(++index < length) { - result[index] = collection[props[index]]; - } - return result; + function at(collection) { + return baseAt(collection, baseFlatten(arguments, true, false, 1)); } /** @@ -4731,8 +4778,8 @@ * @memberOf _ * @category Functions * @param {Object} object The object to bind and assign the bound methods to. - * @param {...string} [methodName] The object method names to - * bind, specified as individual method names or arrays of method names. + * @param {...string} [methodNames] The object method names to bind, specified + * as individual method names or arrays of method names. * @returns {Object} Returns `object`. * @example * @@ -5347,7 +5394,7 @@ * @alias extend * @category Objects * @param {Object} object The destination object. - * @param {...Object} [source] The source objects. + * @param {...Object} [sources] The source objects. * @param {Function} [callback] The function to customize assigning values. * @param {*} [thisArg] The `this` binding of `callback`. * @returns {Object} Returns the destination object. @@ -5555,7 +5602,7 @@ * @memberOf _ * @category Objects * @param {Object} object The destination object. - * @param {...Object} [source] The source objects. + * @param {...Object} [sources] The source objects. * @param- {Object} [guard] Enables use as a callback for functions like `_.reduce`. * @returns {Object} Returns the destination object. * @example @@ -6508,7 +6555,7 @@ * @memberOf _ * @category Objects * @param {Object} object The destination object. - * @param {...Object} [source] The source objects. + * @param {...Object} [sources] The source objects. * @param {Function} [callback] The function to customize merging properties. * @param {*} [thisArg] The `this` binding of `callback`. * @returns {Object} Returns the destination object. @@ -6587,7 +6634,7 @@ * @memberOf _ * @category Objects * @param {Object} object The source object. - * @param {Function|...string|string[]} [predicate] The function called per + * @param {Function|...(string|string[])} [predicate] 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 `predicate`. @@ -6613,7 +6660,7 @@ while (length--) { omitProps[length] = String(omitProps[length]); } - return pick(object, baseDifference(keysIn(object), omitProps)); + return pick(object, baseDifference(keysIn(object), omitProps)); } /** @@ -6655,7 +6702,7 @@ * @memberOf _ * @category Objects * @param {Object} object The source object. - * @param {Function|...string|string[]} [predicate] The function called per + * @param {Function|...(string|string[])} [predicate] The function called per * iteration or property names to pick, specified as individual property * names or arrays of property names. * @param {*} [thisArg] The `this` binding of `predicate`. @@ -8122,6 +8169,7 @@ lodash.pluck = pluck; lodash.property = property; lodash.pull = pull; + lodash.pullAt = pullAt; lodash.range = range; lodash.reject = reject; lodash.remove = remove; diff --git a/dist/lodash.min.js b/dist/lodash.min.js index f39a58989..a2357273a 100644 --- a/dist/lodash.min.js +++ b/dist/lodash.min.js @@ -3,64 +3,64 @@ * Lo-Dash 2.4.1 (Custom Build) lodash.com/license | Underscore.js 1.6.0 underscorejs.org/LICENSE * Build: `lodash modern -o ./dist/lodash.js` */ -;(function(){function n(n,t){return typeof n=="undefined"?t:n}function t(n,t){if(n!==t){if(n>t||typeof n=="undefined")return 1;if(nr||13r||8202e||13e||8202>>0:0,u=$e(r);++ei(t,f)&&l.push(f);return l}function mt(n,t){var e=-1,r=n?n.length:0;if(typeof r=="number"&&-1a(p,h)&&((u||l)&&p.push(h),c.push(s))}return c}function Rt(n,t){for(var e=-1,r=t(n),u=r.length,o=$e(u);++eo?0:o)}function Ut(n,t,r){var u=n?n.length:0;if(typeof r=="number")r=0>r?br(u+r,0):r||0;else if(r)return r=Vt(n,t),u&&n[r]===t?r:-1;return e(n,t,r)}function Zt(n,t,e){var r=n?n.length:0;if(typeof t!="number"&&null!=t){var u=r,o=0;for(t=c.createCallback(t,e,3);u--&&t(n[u],u,n);)o++ -}else o=null==t||e?1:t;return o=r-(o||0),Mt(n,0,0>o?0:o)}function Pt(n,t,e){var r=n?n.length:0;if(typeof t!="number"&&null!=t){var u=r,o=0;for(t=c.createCallback(t,e,3);u--&&t(n[u],u,n);)o++}else if(o=t,null==o||e)return n?n[r-1]:m;return o=r-(o||0),Mt(n,0>o?0:o)}function Kt(n,t,e){if(typeof t!="number"&&null!=t){var r=-1,u=n?n.length:0,o=0;for(t=c.createCallback(t,e,3);++rt?0:t;return Mt(n,o)}function Mt(n,t,e){var r=-1,u=n?n.length:0;for(t=typeof t=="undefined"?0:+t||0,0>t?t=br(u+t,0):t>u&&(t=u),e=typeof e=="undefined"?u:+e||0,0>e?e=br(u+e,0):e>u&&(e=u),u=t>e?0:e-t,e=$e(u);++r>>1,e(n[r])e?0:e);++te?br(r+e,0):e||0:0,typeof n=="string"||!Sr(n)&&ke(n)?eo&&(o=a)}else t=null==t&&ke(n)?u:c.createCallback(t,e,3),mt(n,function(n,e,u){e=t(n,e,u),(e>r||-1/0===e&&e===o)&&(r=e,o=n)});return o}function ie(n,t){return ue(n,Fe(t))}function ae(n,t,e,r){var u=3>arguments.length;t=c.createCallback(t,r,4);var o=-1,i=n?n.length:0;if(typeof i=="number"&&-1arguments.length;return t=c.createCallback(t,r,4),dt(n,function(n,r,o){e=u?(u=false,n):t(e,n,r,o) -}),e}function le(n){var t=-1,e=n&&n.length,r=$e(0>e?0:e>>>0);return mt(n,function(n){var e=Et(0,++t);r[t]=r[e],r[e]=n}),r}function ce(n,t,e){var r;t=c.createCallback(t,e,3),e=-1;var u=n?n.length:0;if(typeof u=="number"&&-1arguments.length)return Wt(n,d,null,t);if(n)var e=n[C]?n[C][2]:n.length,r=Mt(arguments,2),e=e-r.length;return Wt(n,d|j,e,t,r)}function se(n,t,e){function r(){c&&tr(c),i=c=p=m,(g||h!==t)&&(s=Dr(),a=n.apply(l,o),c||i||(o=l=null)) -}function u(){var e=t-(Dr()-f);0>=e||e>t?(i&&tr(i),e=p,i=c=p=m,e&&(s=Dr(),a=n.apply(l,o),c||i||(o=l=null))):c=lr(u,e)}var o,i,a,f,l,c,p,s=0,h=false,g=true;if(!be(n))throw new Ke(O);if(t=0>t?0:t,true===e)var v=true,g=false;else _e(e)&&(v=e.leading,h="maxWait"in e&&br(t,+e.maxWait||0),g="trailing"in e?e.trailing:g);return function(){if(o=arguments,f=Dr(),l=this,p=g&&(c||!v),false===h)var e=v&&!c;else{i||v||(s=f);var y=h-(f-s),m=0>=y||y>h;m?(i&&(i=tr(i)),s=f,a=n.apply(l,o)):i||(i=lr(r,y))}return m&&c?c=tr(c):c||t===h||(c=lr(u,t)),e&&(m=true,a=n.apply(l,o)),!m||c||i||(o=l=null),a -}}function he(n){if(!be(n))throw new Ke(O);return function(){return!n.apply(this,arguments)}}function ge(n,t,e){var r=arguments;if(!n||2>r.length)return n;var u=0,o=r.length,i=typeof e;if("number"!=i&&"string"!=i||!r[3]||r[3][e]!==t||(o=2),3>>0,r=n.constructor,u=-1,r=r&&n===r.prototype,o=e-1,i=$e(e),a=0t||null==n||!yr(t))return e;n=Pe(n);do t%2&&(e+=n),t=er(t/2),n+=n;while(t);return e}function Ie(n,t){return(n=null==n?"":Pe(n))?null==t?n.slice(h(n),g(n)+1):(t=Pe(t),n.slice(o(n,t),i(n,t)+1)):n}function Re(n,t,e){var r=typeof n;return"function"==r||null==n?(typeof t=="undefined"||!(n&&"prototype"in n))&&n||st(n,t,e):"object"==r?Se(n):Fe(n) -}function Ne(n){return n}function Se(n){var t=Wr(n),e=t.length,r=t[0],u=e&&n[r];return 1!=e||u!==u||_e(u)?function(r){var u=e;if(u&&!r)return false;for(var o=true;u--&&(o=t[u],o=or.call(r,o)&&Ot(r[o],n[o],null,true)););return o}:function(n){return n&&or.call(n,r)?(n=n[r],u===n&&(0!==u||1/u==1/n)):false}}function Te(n,t,e){var r=true,u=t&&ye(t);t&&(e||u.length)||(null==e&&(e=t),t=n,n=this,u=ye(t)),false===e?r=false:_e(e)&&"chain"in e&&(r=e.chain),e=-1;for(var o=be(n),i=u?u.length:0;++e--n?t.apply(this,arguments):void 0 -}},c.assign=ge,c.at=function(n,t){var e=arguments,r=-1,u=_t(e,true,false,1),o=u.length,i=typeof t;for("number"!=i&&"string"!=i||!e[2]||e[2][t]!==n||(o=1),e=$e(o);++rarguments.length?Wt(t,d|b,null,n):Wt(t,d|b|j,null,n,Mt(arguments,2))},c.chain=function(n){return new q(n,true)},c.compact=function(n){for(var t=-1,e=n?n.length:0,r=0,u=[];++t(s?r(s,f):i(p,f))){for(t=u;--t;){var h=o[t];if(0>(h?r(h,f):i(n[t],f)))continue n}s&&s.push(f),p.push(f)}return p},c.invert=function(n,t){for(var e=-1,r=Wr(n),u=r.length,o={};++eo?0:o>>>0);return mt(n,function(n){var o=u?t:null!=n&&n[t];i[++r]=o?o.apply(n,e):m -}),i},c.keys=Wr,c.keysIn=xe,c.map=ue,c.mapValues=function(n,t,e){var r={};return t=c.createCallback(t,e,3),xt(n,function(n,e,u){r[e]=t(n,e,u)}),r},c.matches=Se,c.max=oe,c.memoize=function(n,t){function e(){var r=e.cache,u=t?t.apply(this,arguments):"_"+arguments[0];return or.call(r,u)?r[u]:r[u]=n.apply(this,arguments)}if(!be(n)||t&&!be(t))throw new Ke(O);return e.cache={},e},c.merge=function(n,t,e){var r=arguments,u=r.length,o=typeof e;if(!n||2>u)return n;if("number"!=o&&"string"!=o||!r[3]||r[3][e]!==t||(u=2),3u?0:u>>>0);for(o||(t=c.createCallback(t,e,3)),mt(n,function(n,e,u){if(o)for(e=t.length,u=$e(e);e--;)u[e]=n[t[e]];else u=t(n,e,u);i[++r]={a:u,b:r,c:n}}),u=i.length,i.sort(o?f:a);u--;)i[u]=i[u].c;return i},c.tap=function(n,t,e){return t.call(e,n),n},c.throttle=function(n,t,e){var r=true,u=true;if(!be(n))throw new Ke(O); -return false===e?r=false:_e(e)&&(r="leading"in e?!!e.leading:r,u="trailing"in e?!!e.trailing:u),it.leading=r,it.maxWait=+t,it.trailing=u,se(n,t,it)},c.times=function(n,t,e){n=0>n?0:n>>>0,t=st(t,e,1),e=-1;for(var r=$e(n);++ee?0:+e||0,r))-t.length,0<=e&&n.indexOf(t,e)==e},c.escape=function(n){return null==n?"":Pe(n).replace(T,p)},c.escapeRegExp=Ae,c.every=Qt,c.find=te,c.findIndex=Bt,c.findKey=function(n,t,e){return t=c.createCallback(t,e,3),bt(n,t,xt,true) -},c.findLast=function(n,t,e){return t=c.createCallback(t,e,3),bt(n,t,dt)},c.findLastIndex=function(n,t,e){var r=n?n.length:0;for(t=c.createCallback(t,e,3);r--;)if(t(n[r],r,n))return r;return-1},c.findLastKey=function(n,t,e){return t=c.createCallback(t,e,3),bt(n,t,Ct,true)},c.findWhere=function(n,t){return te(n,Se(t))},c.has=function(n,t){return n?or.call(n,t):false},c.identity=Ne,c.indexOf=Ut,c.isArguments=me,c.isArray=Sr,c.isBoolean=function(n){return true===n||false===n||n&&typeof n=="object"&&He.call(n)==G||false -},c.isDate=function(n){return n&&typeof n=="object"&&He.call(n)==H||false},c.isElement=de,c.isEmpty=function(n){var t=true;if(!n)return t;var e=n.length;return-1e?br(r+e,0):_r(e||0,r-1))+1);r--;)if(n[r]===t)return r;return-1},c.noConflict=function(){return t._=Ye,this},c.noop=We,c.now=Dr,c.pad=function(n,t,e){n=null==n?"":Pe(n),t=+t; -var r=n.length;return re?0:+e||0,n.length),n.lastIndexOf(t,e)==e},c.template=function(n,t,e){var r=c.templateSettings;e=ve({},e,r),n=Pe(null==n?"":n);var u,o,i=ve({},e.imports,r.imports),r=Wr(i),i=Oe(i),a=0,f=e.interpolate||U,l="__p+='",f=Ze((e.escape||U).source+"|"+f.source+"|"+(f===$?z:U).source+"|"+(e.evaluate||U).source+"|$","g"); -n.replace(f,function(t,e,r,i,f,c){return r||(r=i),l+=n.slice(a,c).replace(K,s),e&&(u=true,l+="'+__e("+e+")+'"),f&&(o=true,l+="';"+f+";\n__p+='"),r&&(l+="'+((__t=("+r+"))==null?'':__t)+'"),a=c+t.length,t}),l+="';",(e=e.variable)||(l="with(obj){"+l+"}"),l=(o?l.replace(I,""):l).replace(R,"$1").replace(N,"$1;"),l="function("+(e||"obj")+"){"+(e?"":"obj||(obj={});")+"var __t,__p=''"+(u?",__e=_.escape":"")+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}";try{var p=Le(r,"return "+l).apply(m,i) -}catch(h){throw h.source=l,h}return t?p(t):(p.source=l,p)},c.trim=Ie,c.trimLeft=function(n,t){return(n=null==n?"":Pe(n))?null==t?n.slice(h(n)):(t=Pe(t),n.slice(o(n,t))):n},c.trimRight=function(n,t){return(n=null==n?"":Pe(n))?null==t?n.slice(0,g(n)+1):(t=Pe(t),n.slice(0,i(n,t)+1)):n},c.truncate=function(n,t){var e=30,r="...";if(t&&_e(t))var u="separator"in t?t.separator:u,e="length"in t?+t.length||0:e,r="omission"in t?Pe(t.omission):r;else null!=t&&(e=+t||0);if(n=null==n?"":Pe(n),e>=n.length)return n; -var o=e-r.length;if(1>o)return r;if(e=n.slice(0,o),null==u)return e+r;if(je(u)){if(n.slice(o).search(u)){var i,a,f=n.slice(0,o);for(u.global||(u=Ze(u.source,(D.exec(u)||"")+"g")),u.lastIndex=0;i=u.exec(f);)a=i.index;e=e.slice(0,null==a?o:a)}}else n.indexOf(u,o)!=o&&(u=e.lastIndexOf(u),-1n.indexOf(";")?n:n.replace(S,v))},c.uniqueId=function(n){var t=++A;return Pe(null==n?"":n)+t},c.all=Qt,c.any=ce,c.detect=te,c.foldl=ae,c.foldr=fe,c.include=Ht,c.inject=ae,Te(c,function(){var n={}; -return xt(c,function(t,e){c.prototype[e]||(n[e]=t)}),n}(),false),c.first=qt,c.last=Pt,c.sample=function(n,t,e){return n&&typeof n.length!="number"&&(n=Oe(n)),null==t||e?(t=n?n.length:0,0t?0:+t||0,n.length),n)},c.take=qt,c.takeRight=Pt,c.takeRightWhile=Pt,c.takeWhile=qt,c.head=qt,xt(c,function(n,t){var e="sample"!==t;c.prototype[t]||(c.prototype[t]=function(t,r){var u=this.__chain__,o=n(this.__wrapped__,t,r);return u||null!=t&&(!r||e&&typeof t=="function")?new q(o,u):o -})}),c.VERSION=x,c.prototype.chain=function(){return this.__chain__=true,this},c.prototype.toJSON=Gt,c.prototype.toString=function(){return Pe(this.__wrapped__)},c.prototype.value=Gt,c.prototype.valueOf=Gt,M(["join","pop","shift"],function(n){var t=Me[n];c.prototype[n]=function(){var n=this.__chain__,e=t.apply(this.__wrapped__,arguments);return n?new q(e,n):e}}),M(["push","reverse","sort","unshift"],function(n){var t=Me[n];c.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),M(["concat","splice"],function(n){var t=Me[n]; -c.prototype[n]=function(){return new q(t.apply(this.__wrapped__,arguments),this.__chain__)}}),c}var m,d=1,b=2,_=4,w=8,j=16,k=32,x="2.4.1",C="__lodash@"+x+"__",O="Expected a function",A=0,E=/^[A-Z]+$/,I=/\b__p\+='';/g,R=/\b(__p\+=)''\+/g,N=/(__e\(.*?\)|\b__t\))\+'';/g,S=/&(?:amp|lt|gt|quot|#39);/g,T=/[&<>"']/g,W=/<%-([\s\S]+?)%>/g,F=/<%([\s\S]+?)%>/g,$=/<%=([\s\S]+?)%>/g,z=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,D=/\w*$/,L=/^\s*function[ \n\r\t]+\w/,B=/^0[xX]/,q=/[\xC0-\xFF]/g,U=/($^)/,Z=/[.*+?^${}()|[\]\/\\]/g,P=/\bthis\b/,K=/['\n\r\u2028\u2029\\]/g,M=/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[a-z]+|[0-9]+/g,V=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",J="Array Boolean Date Function Math Number Object RegExp Set String _ clearTimeout document isFinite isNaN parseInt setTimeout TypeError window WinRTError".split(" "),X="[object Arguments]",Y="[object Array]",G="[object Boolean]",H="[object Date]",Q="[object Error]",nt="[object Function]",tt="[object Number]",et="[object Object]",rt="[object RegExp]",ut="[object String]",ot={}; -ot[nt]=false,ot[X]=ot[Y]=ot[G]=ot[H]=ot[tt]=ot[et]=ot[rt]=ot[ut]=true;var it={leading:false,maxWait:0,trailing:false},at={configurable:false,enumerable:false,value:null,writable:false},ft={"&":"&","<":"<",">":">",'"':""","'":"'"},lt={"&":"&","<":"<",">":">",""":'"',"'":"'"},ct={\u00c0:"A",\u00c1:"A",\u00c2:"A",\u00c3:"A",\u00c4:"A",\u00c5:"A",\u00e0:"a",\u00e1:"a",\u00e2:"a",\u00e3:"a",\u00e4:"a",\u00e5:"a",\u00c7:"C",\u00e7:"c",\u00d0:"D",\u00f0:"d",\u00c8:"E",\u00c9:"E",\u00ca:"E",\u00cb:"E",\u00e8:"e",\u00e9:"e",\u00ea:"e",\u00eb:"e",\u00cc:"I",\u00cd:"I",\u00ce:"I",\u00cf:"I",\u00ec:"i",\u00ed:"i",\u00ee:"i",\u00ef:"i",\u00d1:"N",\u00f1:"n",\u00d2:"O",\u00d3:"O",\u00d4:"O",\u00d5:"O",\u00d6:"O",\u00d8:"O",\u00f2:"o",\u00f3:"o",\u00f4:"o",\u00f5:"o",\u00f6:"o",\u00f8:"o",\u00d9:"U",\u00da:"U",\u00db:"U",\u00dc:"U",\u00f9:"u",\u00fa:"u",\u00fb:"u",\u00fc:"u",\u00dd:"Y",\u00fd:"y",\u00ff:"y",\u00c6:"AE",\u00e6:"ae",\u00de:"Th",\u00fe:"th",\u00df:"ss","\xd7":" ","\xf7":" "},pt={"function":true,object:true},st={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ht=pt[typeof window]&&window||this,gt=pt[typeof exports]&&exports&&!exports.nodeType&&exports,pt=pt[typeof module]&&module&&!module.nodeType&&module,vt=gt&&pt&&typeof global=="object"&&global; -!vt||vt.global!==vt&&vt.window!==vt&&vt.self!==vt||(ht=vt);var vt=pt&&pt.exports===gt&>,yt=y();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(ht._=yt, define(function(){return yt})):gt&&pt?vt?(pt.exports=yt)._=yt:gt._=yt:ht._=yt}).call(this); \ No newline at end of file +;(function(){function n(n,t){return typeof n=="undefined"?t:n}function t(n,t){for(var r=-1,e=t.length,u=Array(e);++rt||typeof n=="undefined")return 1;if(ne||13e||8202r||13r||8202>>0:0,u=Dr(e);++ri(t,f)&&l.push(f);return l}function bt(n,t){var r=-1,e=n?n.length:0;if(typeof e=="number"&&-1a(p,h)&&((r||l)&&p.push(h),c.push(s))}return c}function St(n,t){for(var r=-1,e=t(n),u=e.length,o=Dr(u);++ro?0:o)}function Pt(n,t,r){var u=n?n.length:0;if(typeof r=="number")r=0>r?we(u+r,0):r||0;else if(r)return r=Xt(n,t),u&&n[r]===t?r:-1;return e(n,t,r)}function Kt(n,t,r){var e=n?n.length:0;if(typeof t!="number"&&null!=t){var u=e,o=0;for(t=U.createCallback(t,r,3);u--&&t(n[u],u,n);)o++ +}else o=null==t||r?1:t;return o=e-(o||0),Jt(n,0,0>o?0:o)}function Mt(n,t,r){var e=n?n.length:0;if(typeof t!="number"&&null!=t){var u=e,o=0;for(t=U.createCallback(t,r,3);u--&&t(n[u],u,n);)o++}else if(o=t,null==o||r)return n?n[e-1]:d;return o=e-(o||0),Jt(n,0>o?0:o)}function Vt(n,t,r){if(typeof t!="number"&&null!=t){var e=-1,u=n?n.length:0,o=0;for(t=U.createCallback(t,r,3);++et?0:t;return Jt(n,o)}function Jt(n,t,r){var e=-1,u=n?n.length:0;for(t=typeof t=="undefined"?0:+t||0,0>t?t=we(u+t,0):t>u&&(t=u),r=typeof r=="undefined"?u:+r||0,0>r?r=we(u+r,0):r>u&&(r=u),u=t>r?0:r-t,r=Dr(u);++e>>1,r(n[e])r?0:r);++tr?we(e+r,0):r||0:0,typeof n=="string"||!We(n)&&Cr(n)?ru&&(u=a)}else t=null==t&&Cr(n)?o:U.createCallback(t,r,3),bt(n,function(n,r,o){r=t(n,r,o),(r>e||-1/0===r&&r===u)&&(e=r,u=n)});return u}function fr(n,t){return ir(n,zr(t))}function lr(n,t,r,e){var u=3>arguments.length;t=U.createCallback(t,e,4);var o=-1,i=n?n.length:0;if(typeof i=="number"&&-1arguments.length;return t=U.createCallback(t,e,4),_t(n,function(n,e,o){r=u?(u=false,n):t(r,n,e,o) +}),r}function pr(n){var t=-1,r=n&&n.length,e=Dr(0>r?0:r>>>0);return bt(n,function(n){var r=Rt(0,++t);e[t]=e[r],e[r]=n}),e}function sr(n,t,r){var e;t=U.createCallback(t,r,3),r=-1;var u=n?n.length:0;if(typeof u=="number"&&-1arguments.length)return $t(n,b,null,t);if(n)var r=n[A]?n[A][2]:n.length,e=Jt(arguments,2),r=r-e.length;return $t(n,b|k,r,t,e)}function gr(n,t,r){var e,u,o,i,a,f,l,c=0,p=false,s=true; +if(!wr(n))throw new Vr(O);if(t=0>t?0:t,true===r)var h=true,s=false;else jr(r)&&(h=r.leading,p="maxWait"in r&&we(t,+r.maxWait||0),s="trailing"in r?r.trailing:s);var g=function(){var r=t-(Be()-i);0>=r||r>t?(u&&ee(u),r=l,u=f=l=d,r&&(c=Be(),o=n.apply(a,e),f||u||(e=a=null))):f=pe(g,r)},v=function(){f&&ee(f),u=f=l=d,(s||p!==t)&&(c=Be(),o=n.apply(a,e),f||u||(e=a=null))};return function(){if(e=arguments,i=Be(),a=this,l=s&&(f||!h),false===p)var r=h&&!f;else{u||h||(c=i);var y=p-(i-c),m=0>=y||y>p;m?(u&&(u=ee(u)),c=i,o=n.apply(a,e)):u||(u=pe(v,y)) +}return m&&f?f=ee(f):f||t===p||(f=pe(g,t)),r&&(m=true,o=n.apply(a,e)),!m||f||u||(e=a=null),o}}function vr(n){if(!wr(n))throw new Vr(O);return function(){return!n.apply(this,arguments)}}function yr(n,t,r){var e=arguments;if(!n||2>e.length)return n;var u=0,o=e.length,i=typeof r;if("number"!=i&&"string"!=i||!e[3]||e[3][r]!==t||(o=2),3>>0,e=n.constructor,u=-1,e=e&&n===e.prototype,o=r-1,i=Dr(r),a=0t||null==n||!de(t))return r;n=Mr(n);do t%2&&(r+=n),t=ue(t/2),n+=n;while(t);return r}function Nr(n,t){return(n=null==n?"":Mr(n))?null==t?n.slice(g(n),v(n)+1):(t=Mr(t),n.slice(i(n,t),a(n,t)+1)):n +}function Sr(n,t,r){var e=typeof n;return"function"==e||null==n?(typeof t=="undefined"||!(n&&"prototype"in n))&&n||vt(n,t,r):"object"==e?Wr(n):zr(n)}function Tr(n){return n}function Wr(n){var t=$e(n),r=t.length,e=t[0],u=r&&n[e];return 1!=r||u!==u||jr(u)?function(e){var u=r;if(u&&!e)return false;for(var o=true;u--&&(o=t[u],o=ae.call(e,o)&&Et(e[o],n[o],null,true)););return o}:function(n){return n&&ae.call(n,e)?(n=n[e],u===n&&(0!==u||1/u==1/n)):false}}function Fr(n,t,r){var e=true,u=t&&dr(t);t&&(r||u.length)||(null==r&&(r=t),t=n,n=this,u=dr(t)),false===r?e=false:jr(r)&&"chain"in r&&(e=r.chain),r=-1; +for(var o=wr(n),i=u?u.length:0;++r--n?t.apply(this,arguments):void 0 +}},U.assign=yr,U.at=function(n){return t(n,jt(arguments,true,false,1))},U.bind=hr,U.bindAll=function(n){for(var t=1arguments.length?$t(t,b|_,null,n):$t(t,b|_|k,null,n,Jt(arguments,2))},U.chain=function(n){return new V(n,true)},U.compact=function(n){for(var t=-1,r=n?n.length:0,e=0,u=[];++t(s?u(s,f):i(p,f))){for(t=r;--t;){var h=o[t]; +if(0>(h?u(h,f):i(n[t],f)))continue n}s&&s.push(f),p.push(f)}return p},U.invert=function(n,t){for(var r=-1,e=$e(n),u=e.length,o={};++ro?0:o>>>0);return bt(n,function(n){var o=u?t:null!=n&&n[t];i[++e]=o?o.apply(n,r):d}),i},U.keys=$e,U.keysIn=Ar,U.map=ir,U.mapValues=function(n,t,r){var e={};return t=U.createCallback(t,r,3),At(n,function(n,r,u){e[r]=t(n,r,u) +}),e},U.matches=Wr,U.max=ar,U.memoize=function(n,t){if(!wr(n)||t&&!wr(t))throw new Vr(O);var r=function(){var e=r.cache,u=t?t.apply(this,arguments):"_"+arguments[0];return ae.call(e,u)?e[u]:e[u]=n.apply(this,arguments)};return r.cache={},r},U.merge=function(n,t,r){var e=arguments,u=e.length,o=typeof r;if(!n||2>u)return n;if("number"!=o&&"string"!=o||!e[3]||e[3][r]!==t||(u=2),3u?0:u>>>0);for(o||(t=U.createCallback(t,r,3)),bt(n,function(n,r,u){if(o)for(r=t.length,u=Dr(r);r--;)u[r]=n[t[r]];else u=t(n,r,u);i[++e]={a:u,b:e,c:n}}),u=i.length,i.sort(o?l:f);u--;)i[u]=i[u].c;return i},U.tap=function(n,t,r){return t.call(r,n),n},U.throttle=function(n,t,r){var e=true,u=true;if(!wr(n))throw new Vr(O);return false===r?e=false:jr(r)&&(e="leading"in r?!!r.leading:e,u="trailing"in r?!!r.trailing:u),at.leading=e,at.maxWait=+t,at.trailing=u,gr(n,t,at) +},U.times=function(n,t,r){n=0>n?0:n>>>0,t=vt(t,r,1),r=-1;for(var e=Dr(n);++rr?0:+r||0,e))-t.length,0<=r&&n.indexOf(t,r)==r},U.escape=function(n){return null==n?"":Mr(n).replace(W,s)},U.escapeRegExp=Ir,U.every=tr,U.find=er,U.findIndex=Ut,U.findKey=function(n,t,r){return t=U.createCallback(t,r,3),wt(n,t,At,true) +},U.findLast=function(n,t,r){return t=U.createCallback(t,r,3),wt(n,t,_t)},U.findLastIndex=function(n,t,r){var e=n?n.length:0;for(t=U.createCallback(t,r,3);e--;)if(t(n[e],e,n))return e;return-1},U.findLastKey=function(n,t,r){return t=U.createCallback(t,r,3),wt(n,t,Ot,true)},U.findWhere=function(n,t){return er(n,Wr(t))},U.has=function(n,t){return n?ae.call(n,t):false},U.identity=Tr,U.indexOf=Pt,U.isArguments=br,U.isArray=We,U.isBoolean=function(n){return true===n||false===n||n&&typeof n=="object"&&ne.call(n)==H||false +},U.isDate=function(n){return n&&typeof n=="object"&&ne.call(n)==Q||false},U.isElement=_r,U.isEmpty=function(n){var t=true;if(!n)return t;var r=n.length;return-1r?we(e+r,0):je(r||0,e-1))+1);e--;)if(n[e]===t)return e;return-1},U.noConflict=function(){return p._=Hr,this},U.noop=$r,U.now=Be,U.pad=function(n,t,r){n=null==n?"":Mr(n),t=+t; +var e=n.length;return er?0:+r||0,n.length),n.lastIndexOf(t,r)==r},U.template=function(n,t,r){var e=U.templateSettings;r=mr({},r,e),n=Mr(null==n?"":n);var u,o,i=mr({},r.imports,e.imports),e=$e(i),i=Er(i),a=0,f=r.interpolate||Z,l="__p+='",f=Kr((r.escape||Z).source+"|"+f.source+"|"+(f===z?D:Z).source+"|"+(r.evaluate||Z).source+"|$","g"); +n.replace(f,function(t,r,e,i,f,c){return e||(e=i),l+=n.slice(a,c).replace(M,h),r&&(u=true,l+="'+__e("+r+")+'"),f&&(o=true,l+="';"+f+";\n__p+='"),e&&(l+="'+((__t=("+e+"))==null?'':__t)+'"),a=c+t.length,t}),l+="';",(r=r.variable)||(l="with(obj){"+l+"}"),l=(o?l.replace(R,""):l).replace(N,"$1").replace(S,"$1;"),l="function("+(r||"obj")+"){"+(r?"":"obj||(obj={});")+"var __t,__p=''"+(u?",__e=_.escape":"")+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}";try{var c=qr(e,"return "+l).apply(d,i) +}catch(p){throw p.source=l,p}return t?c(t):(c.source=l,c)},U.trim=Nr,U.trimLeft=function(n,t){return(n=null==n?"":Mr(n))?null==t?n.slice(g(n)):(t=Mr(t),n.slice(i(n,t))):n},U.trimRight=function(n,t){return(n=null==n?"":Mr(n))?null==t?n.slice(0,v(n)+1):(t=Mr(t),n.slice(0,a(n,t)+1)):n},U.truncate=function(n,t){var r=30,e="...";if(t&&jr(t))var u="separator"in t?t.separator:u,r="length"in t?+t.length||0:r,e="omission"in t?Mr(t.omission):e;else null!=t&&(r=+t||0);if(n=null==n?"":Mr(n),r>=n.length)return n; +var o=r-e.length;if(1>o)return e;if(r=n.slice(0,o),null==u)return r+e;if(xr(u)){if(n.slice(o).search(u)){var i,a,f=n.slice(0,o);for(u.global||(u=Kr(u.source,(L.exec(u)||"")+"g")),u.lastIndex=0;i=u.exec(f);)a=i.index;r=r.slice(0,null==a?o:a)}}else n.indexOf(u,o)!=o&&(u=r.lastIndexOf(u),-1n.indexOf(";")?n:n.replace(T,y))},U.uniqueId=function(n){var t=++E;return Mr(null==n?"":n)+t},U.all=tr,U.any=sr,U.detect=er,U.foldl=lr,U.foldr=cr,U.include=nr,U.inject=lr,Fr(U,function(){var n={}; +return At(U,function(t,r){U.prototype[r]||(n[r]=t)}),n}(),false),U.first=Zt,U.last=Mt,U.sample=function(n,t,r){return n&&typeof n.length!="number"&&(n=Er(n)),null==t||r?(t=n?n.length:0,0t?0:+t||0,n.length),n)},U.take=Zt,U.takeRight=Mt,U.takeRightWhile=Mt,U.takeWhile=Zt,U.head=Zt,At(U,function(n,t){var r="sample"!==t;U.prototype[t]||(U.prototype[t]=function(t,e){var u=this.__chain__,o=n(this.__wrapped__,t,e);return u||null!=t&&(!e||r&&typeof t=="function")?new V(o,u):o +})}),U.VERSION=C,U.prototype.chain=function(){return this.__chain__=true,this},U.prototype.toJSON=Qt,U.prototype.toString=function(){return Mr(this.__wrapped__)},U.prototype.value=Qt,U.prototype.valueOf=Qt,lt(["join","pop","shift"],function(n){var t=Jr[n];U.prototype[n]=function(){var n=this.__chain__,r=t.apply(this.__wrapped__,arguments);return n?new V(r,n):r}}),lt(["push","reverse","sort","unshift"],function(n){var t=Jr[n];U.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this} +}),lt(["concat","splice"],function(n){var t=Jr[n];U.prototype[n]=function(){return new V(t.apply(this.__wrapped__,arguments),this.__chain__)}}),U}var d,b=1,_=2,w=4,j=8,k=16,x=32,C="2.4.1",A="__lodash@"+C+"__",O="Expected a function",E=0,I=/^[A-Z]+$/,R=/\b__p\+='';/g,N=/\b(__p\+=)''\+/g,S=/(__e\(.*?\)|\b__t\))\+'';/g,T=/&(?:amp|lt|gt|quot|#39);/g,W=/[&<>"']/g,F=/<%-([\s\S]+?)%>/g,$=/<%([\s\S]+?)%>/g,z=/<%=([\s\S]+?)%>/g,D=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,L=/\w*$/,B=/^\s*function[ \n\r\t]+\w/,q=/^0[xX]/,U=/[\xC0-\xFF]/g,Z=/($^)/,P=/[.*+?^${}()|[\]\/\\]/g,K=/\bthis\b/,M=/['\n\r\u2028\u2029\\]/g,V=/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[a-z]+|[0-9]+/g,J=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",X="Array Boolean Date Function Math Number Object RegExp Set String _ clearTimeout document isFinite isNaN parseInt setTimeout TypeError window WinRTError".split(" "),Y="[object Arguments]",G="[object Array]",H="[object Boolean]",Q="[object Date]",nt="[object Error]",tt="[object Function]",rt="[object Number]",et="[object Object]",ut="[object RegExp]",ot="[object String]",it={}; +it[tt]=false,it[Y]=it[G]=it[H]=it[Q]=it[rt]=it[et]=it[ut]=it[ot]=true;var at={leading:false,maxWait:0,trailing:false},ft={configurable:false,enumerable:false,value:null,writable:false},lt={"&":"&","<":"<",">":">",'"':""","'":"'"},ct={"&":"&","<":"<",">":">",""":'"',"'":"'"},pt={\u00c0:"A",\u00c1:"A",\u00c2:"A",\u00c3:"A",\u00c4:"A",\u00c5:"A",\u00e0:"a",\u00e1:"a",\u00e2:"a",\u00e3:"a",\u00e4:"a",\u00e5:"a",\u00c7:"C",\u00e7:"c",\u00d0:"D",\u00f0:"d",\u00c8:"E",\u00c9:"E",\u00ca:"E",\u00cb:"E",\u00e8:"e",\u00e9:"e",\u00ea:"e",\u00eb:"e",\u00cc:"I",\u00cd:"I",\u00ce:"I",\u00cf:"I",\u00ec:"i",\u00ed:"i",\u00ee:"i",\u00ef:"i",\u00d1:"N",\u00f1:"n",\u00d2:"O",\u00d3:"O",\u00d4:"O",\u00d5:"O",\u00d6:"O",\u00d8:"O",\u00f2:"o",\u00f3:"o",\u00f4:"o",\u00f5:"o",\u00f6:"o",\u00f8:"o",\u00d9:"U",\u00da:"U",\u00db:"U",\u00dc:"U",\u00f9:"u",\u00fa:"u",\u00fb:"u",\u00fc:"u",\u00dd:"Y",\u00fd:"y",\u00ff:"y",\u00c6:"AE",\u00e6:"ae",\u00de:"Th",\u00fe:"th",\u00df:"ss","\xd7":" ","\xf7":" "},st={"function":true,object:true},ht={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},gt=st[typeof window]&&window||this,vt=st[typeof exports]&&exports&&!exports.nodeType&&exports,st=st[typeof module]&&module&&!module.nodeType&&module,yt=vt&&st&&typeof global=="object"&&global; +!yt||yt.global!==yt&&yt.window!==yt&&yt.self!==yt||(gt=yt);var yt=st&&st.exports===vt&&vt,mt=m();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(gt._=mt, define(function(){return mt})):vt&&st?yt?(st.exports=mt)._=mt:vt._=mt:gt._=mt}).call(this); \ No newline at end of file diff --git a/dist/lodash.underscore.js b/dist/lodash.underscore.js index 8ad0e1bca..aaf23e308 100644 --- a/dist/lodash.underscore.js +++ b/dist/lodash.underscore.js @@ -284,8 +284,8 @@ * `flatten`, `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`, * `forOwnRight`, `functions`, `groupBy`, `indexBy`, `initial`, `intersection`, * `invert`, `invoke`, `keys`, `map`, `mapValues`, `matches`, `max`, `memoize`, - * `merge`, `min`, `mixin`, `noop`, `object`, `omit`, `once`, `pairs`, - * `partial`, `partialRight`, `pick`, `pluck`, `property`, `pull`, `push`, + * `merge`, `min`, `mixin`, `noop`, `object`, `omit`, `once`, `pairs`, `partial`, + * `partialRight`, `pick`, `pluck`, `property`, `pull`, `pullAt`, `push`, * `range`, `reject`, `remove`, `rest`, `reverse`, `shuffle`, `slice`, `sort`, * `sortBy`, `splice`, `tap`, `throttle`, `times`, `toArray`, `transform`, * `union`, `uniq`, `unshift`, `unzip`, `values`, `where`, `without`, `wrap`, @@ -3209,8 +3209,8 @@ * @memberOf _ * @category Functions * @param {Object} object The object to bind and assign the bound methods to. - * @param {...string} [methodName] The object method names to - * bind, specified as individual method names or arrays of method names. + * @param {...string} [methodNames] The object method names to bind, specified + * as individual method names or arrays of method names. * @returns {Object} Returns `object`. * @example * @@ -3703,7 +3703,7 @@ * @alias extend * @category Objects * @param {Object} object The destination object. - * @param {...Object} [source] The source objects. + * @param {...Object} [sources] The source objects. * @param {Function} [callback] The function to customize assigning values. * @param {*} [thisArg] The `this` binding of `callback`. * @returns {Object} Returns the destination object. @@ -3804,7 +3804,7 @@ * @memberOf _ * @category Objects * @param {Object} object The destination object. - * @param {...Object} [source] The source objects. + * @param {...Object} [sources] The source objects. * @param- {Object} [guard] Enables use as a callback for functions like `_.reduce`. * @returns {Object} Returns the destination object. * @example @@ -4411,7 +4411,7 @@ * @memberOf _ * @category Objects * @param {Object} object The source object. - * @param {Function|...string|string[]} [predicate] The function called per + * @param {Function|...(string|string[])} [predicate] 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 `predicate`. @@ -4433,7 +4433,7 @@ while (length--) { omitProps[length] = String(omitProps[length]); } - return pick(object, baseDifference(keysIn(object), omitProps)); + return pick(object, baseDifference(keysIn(object), omitProps)); } /** @@ -4475,7 +4475,7 @@ * @memberOf _ * @category Objects * @param {Object} object The source object. - * @param {Function|...string|string[]} [predicate] The function called per + * @param {Function|...(string|string[])} [predicate] The function called per * iteration or property names to pick, specified as individual property * names or arrays of property names. * @param {*} [thisArg] The `this` binding of `predicate`.