diff --git a/dist/lodash.compat.js b/dist/lodash.compat.js index 71f427204..06598a7fb 100644 --- a/dist/lodash.compat.js +++ b/dist/lodash.compat.js @@ -692,7 +692,7 @@ * `curry`, `debounce`, `defaults`, `defer`, `delay`, `difference`, `filter`, * `flatten`, `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`, * `forOwnRight`, `functions`, `groupBy`, `indexBy`, `initial`, `intersection`, - * `invert`, `invoke`, `keys`, `map`, `mapValues`, `match`, `max`, `memoize`, + * `invert`, `invoke`, `keys`, `map`, `mapValues`, `matches`, `max`, `memoize`, * `merge`, `min`, `noop`, `object`, `omit`, `once`, `pairs`, `partial`, * `partialRight`, `pick`, `pluck`, `property`, `pull`, `push`, `range`, * `reject`, `remove`, `rest`, `reverse`, `shuffle`, `slice`, `sort`, `sortBy`, @@ -6999,7 +6999,7 @@ func || baseCreateCallback(func, thisArg, argCount); } // handle "_.pluck" and "_.where" style callback shorthands - return type != 'object' ? property(func) : match(func); + return type != 'object' ? property(func) : matches(func); } /** @@ -7037,15 +7037,15 @@ * { 'name': 'barney', 'age': 36 } * ]; * - * var matchAge = _.match({ 'age': 36 }); + * var matchesAge = _.matches({ 'age': 36 }); * - * _.filter(characters, matchAge); + * _.filter(characters, matchesAge); * // => [{ 'name': 'barney', 'age': 36 }] * - * _.find(characters, matchAge); + * _.find(characters, matchesAge); * // => { 'name': 'barney', 'age': 36 } */ - function match(source) { + function matches(source) { source || (source = {}); var props = keys(source), @@ -7459,7 +7459,7 @@ lodash.keys = keys; lodash.map = map; lodash.mapValues = mapValues; - lodash.match = match; + lodash.matches = matches; lodash.max = max; lodash.memoize = memoize; lodash.merge = merge; diff --git a/dist/lodash.compat.min.js b/dist/lodash.compat.min.js index bbcaeff9d..117ec18ac 100644 --- a/dist/lodash.compat.min.js +++ b/dist/lodash.compat.min.js @@ -46,7 +46,7 @@ n[u]=Ot(n[u],j,null,n)}return n},u.bindKey=function(n,t){return 3>arguments.leng return"boolean"!=u&&null!=t&&(e=r,r=t,t=false,"number"!=u&&"string"!=u||!e||e[r]!==n||(r=null)),null!=r&&(n=Xt(n,r,e)),mt(n,t)},u.forEach=Ut,u.forEachRight=Vt,u.forIn=function(n,t,r){return t=t&&typeof r=="undefined"?t:H(t,r,3),se(n,t)},u.forInRight=function(n,t,r){var e=[];se(n,function(n,t){e.push(t,n)});var u=e.length;for(t=H(t,r,3);u--&&false!==t(e[u--],e[u],n););return n},u.forOwn=function(n,t,r){return t=t&&typeof r=="undefined"?t:H(t,r,3),dt(n,t)},u.forOwnRight=function(n,t,r){var e=we(n),u=e.length; 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=S&&ce(e?n[e]:l)))}var i=n[0],p=-1,g=i?i.length:0,h=[]; n:for(;++p(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=we(n),u=e.length,o={};++rarguments.length&&be(n))for(;++r [{ 'name': 'barney', 'age': 36 }] * - * _.find(characters, matchAge); + * _.find(characters, matchesAge); * // => { 'name': 'barney', 'age': 36 } */ - function match(source) { + function matches(source) { source || (source = {}); var props = keys(source), @@ -7180,7 +7180,7 @@ lodash.keys = keys; lodash.map = map; lodash.mapValues = mapValues; - lodash.match = match; + lodash.matches = matches; lodash.max = max; lodash.memoize = memoize; lodash.merge = merge; diff --git a/dist/lodash.min.js b/dist/lodash.min.js index 9224c344b..efae24b74 100644 --- a/dist/lodash.min.js +++ b/dist/lodash.min.js @@ -43,7 +43,7 @@ n[u]=Ct(n[u],w,null,n)}return n},y.bindKey=function(n,t){return 3>arguments.leng return"boolean"!=u&&null!=t&&(e=r,r=t,t=false,"number"!=u&&"string"!=u||!e||e[r]!==n||(r=null)),null!=r&&(n=Ut(n,r,e)),mt(n,t)},y.forEach=Kt,y.forEachRight=Mt,y.forIn=function(n,t,r){return t=t&&typeof r=="undefined"?t:ct(t,r,3),o(n,t)},y.forInRight=function(n,t,r){var e=[];o(n,function(n,t){e.push(t,n)});var u=e.length;for(t=ct(t,r,3);u--&&false!==t(e[u--],e[u],n););return n},y.forOwn=function(n,t,r){return t=t&&typeof r=="undefined"?t:ct(t,r,3),dt(n,t)},y.forOwnRight=function(n,t,r){var e=ve(n),u=e.length; 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=A&&ie(e?n[e]:f)))}var a=n[0],s=-1,g=a?a.length:0,h=[]; n:for(;++s(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=ve(n),u=e.length,o={};++rarguments.length&&typeof u=="number")for(;++r`_.constant` * `_.createCallback` * `_.identity` -* `_.match` +* `_.matches` * `_.mixin` * `_.noConflict` * `_.noop` @@ -1131,7 +1131,7 @@ In addition to Lo-Dash methods, wrappers also have the following `Array` methods Chaining is supported in custom builds as long as the `value` method is implicitly or explicitly included in the build. The chainable wrapper functions are:
-`after`, `assign`, `bind`, `bindAll`, `bindKey`, `chain`, `compact`, `compose`, `concat`, `constant`, `countBy`, `create`, `createCallback`, `curry`, `debounce`, `defaults`, `defer`, `delay`, `difference`, `filter`, `flatten`, `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `functions`, `groupBy`, `indexBy`, `initial`, `intersection`, `invert`, `invoke`, `keys`, `map`, `mapValues`, `match`, `max`, `memoize`, `merge`, `min`, `noop`, `object`, `omit`, `once`, `pairs`, `partial`, `partialRight`, `pick`, `pluck`, `property`, `pull`, `push`, `range`, `reject`, `remove`, `rest`, `reverse`, `shuffle`, `slice`, `sort`, `sortBy`, `splice`, `tap`, `throttle`, `times`, `toArray`, `transform`, `union`, `uniq`, `unshift`, `unzip`, `values`, `where`, `without`, `wrap`, `xor`, and `zip` +`after`, `assign`, `bind`, `bindAll`, `bindKey`, `chain`, `compact`, `compose`, `concat`, `constant`, `countBy`, `create`, `createCallback`, `curry`, `debounce`, `defaults`, `defer`, `delay`, `difference`, `filter`, `flatten`, `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `functions`, `groupBy`, `indexBy`, `initial`, `intersection`, `invert`, `invoke`, `keys`, `map`, `mapValues`, `matches`, `max`, `memoize`, `merge`, `min`, `noop`, `object`, `omit`, `once`, `pairs`, `partial`, `partialRight`, `pick`, `pluck`, `property`, `pull`, `push`, `range`, `reject`, `remove`, `rest`, `reverse`, `shuffle`, `slice`, `sort`, `sortBy`, `splice`, `tap`, `throttle`, `times`, `toArray`, `transform`, `union`, `uniq`, `unshift`, `unzip`, `values`, `where`, `without`, `wrap`, `xor`, and `zip` The non-chainable wrapper functions are:
`capitalize`, `clone`, `cloneDeep`, `contains`, `escape`, `every`, `find`, `findIndex`, `findKey`, `findLast`, `findLastIndex`, `findLastKey`, `has`, `identity`, `indexOf`, `isArguments`, `isArray`, `isBoolean`, `isDate`, `isElement`, `isEmpty`, `isEqual`, `isFinite`, `isFunction`, `isNaN`, `isNull`, `isNumber`, `isObject`, `isPlainObject`, `isRegExp`, `isString`, `isUndefined`, `join`, `lastIndexOf`, `mixin`, `noConflict`, `now`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`, `result`, `shift`, `size`, `some`, `sortedIndex`, `runInContext`, `template`, `trim`, `trimLeft`, `trimRight`, `unescape`, `uniqueId`, and `value` @@ -3989,7 +3989,7 @@ _.omit({ 'name': 'fred', 'age': 40 }, function(value) { ### `_.pairs(object)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6490 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6482 "View in source") [Ⓣ][1] Creates a two dimensional array of an object's key-value pairs, i.e. `[[key1, value1], [key2, value2]]`. @@ -4013,7 +4013,7 @@ _.pairs({ 'barney': 36, 'fred': 40 }); ### `_.pick(object, [callback], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6530 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6522 "View in source") [Ⓣ][1] Creates a shallow clone of `object` composed of the specified properties. Property names may be specified as individual arguments or as arrays of property names. If a callback is provided it will be executed for each property of `object` picking the properties the callback returns truey for. The callback is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. @@ -4044,7 +4044,7 @@ _.pick({ 'name': 'fred', '_userid': 'fred1' }, function(value, key) { ### `_.transform(object, [callback=identity], [accumulator], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6594 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6578 "View in source") [Ⓣ][1] An alternative to `_.reduce`; this method transforms `object` to a new `accumulator` object which is the result of running each of its own enumerable properties through a callback, with each callback execution potentially mutating the `accumulator` object. The callback is bound to `thisArg` and invoked with four arguments; *(accumulator, value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`. @@ -4081,7 +4081,7 @@ var mapped = _.transform({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) ### `_.values(object)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6628 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6612 "View in source") [Ⓣ][1] Creates an array composed of the own enumerable property values of `object`. @@ -4112,7 +4112,7 @@ _.values({ 'one': 1, 'two': 2, 'three': 3 }); ### `_.capitalize(string)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6655 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6639 "View in source") [Ⓣ][1] Converts the first character of `string` to upper case. @@ -4136,7 +4136,7 @@ _.capitalize('fred'); ### `_.escape(string)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6684 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6668 "View in source") [Ⓣ][1] Converts the characters "&", "<", ">", '"', and "'" in `string` to their corresponding HTML entities. @@ -4164,7 +4164,7 @@ _.escape('fred, barney, & pebbles'); ### `_.template(text, [data], [options])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6775 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6759 "View in source") [Ⓣ][1] A micro-templating method that handles arbitrary delimiters, preserves whitespace, and correctly escapes quotes within interpolated code. @@ -4256,7 +4256,7 @@ fs.writeFileSync(path.join(cwd, 'jst.js'), '\ ### `_.trim(string, [chars=whitespace])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6892 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6876 "View in source") [Ⓣ][1] Removes leading and trailing whitespace or specified characters from `string`. @@ -4284,7 +4284,7 @@ _.trim('-_-fred-_-', '_-'); ### `_.trimLeft(string, [chars=whitespace])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6916 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6900 "View in source") [Ⓣ][1] Removes leading whitespace or specified characters from `string`. @@ -4312,7 +4312,7 @@ _.trimLeft('-_-fred-_-', '_-'); ### `_.trimRight(string, [chars=whitespace])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6940 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6924 "View in source") [Ⓣ][1] Removes trailing whitespace or specified characters from `string`. @@ -4340,7 +4340,7 @@ _.trimRight('-_-fred-_-', '_-'); ### `_.unescape(string)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6965 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6949 "View in source") [Ⓣ][1] The inverse of `_.escape`; this method converts the HTML entities `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding characters. @@ -4373,7 +4373,7 @@ _.unescape('fred, barney & pebbles'); ### `_.now` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L7238 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L7222 "View in source") [Ⓣ][1] *(unknown)*: Gets the number of milliseconds that have elapsed since the Unix epoch *(1 January `1970 00`:00:00 UTC)*. @@ -4392,7 +4392,7 @@ _.defer(function() { console.log(_.now() - stamp); }); ### `_.constant(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6990 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6974 "View in source") [Ⓣ][1] Creates a function that returns `value`. @@ -4418,7 +4418,7 @@ getter() === object; ### `_.createCallback([func=identity], [thisArg], [argCount])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L7028 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L7012 "View in source") [Ⓣ][1] Produces a callback bound to an optional `thisArg`. If `func` is a property name the created callback will return the property value for a given element. If `func` is an object the created callback will return `true` for elements that contain the equivalent object properties, otherwise it will return `false`. @@ -4460,7 +4460,7 @@ _.filter(characters, 'age__gt38'); ### `_.identity(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L7052 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L7036 "View in source") [Ⓣ][1] This method returns the first argument provided to it. @@ -4484,8 +4484,8 @@ _.identity(object) === object; -### `_.match(props)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L7081 "View in source") [Ⓣ][1] +### `_.matches(props)` +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L7065 "View in source") [Ⓣ][1] Creates a "_.where" style function, which performs a deep comparison between a given object and the `props` object, returning `true` if the given object has equivalent property values, else `false`. @@ -4502,12 +4502,12 @@ var characters = [ { 'name': 'barney', 'age': 36 } ]; -var matchAge = _.match({ 'age': 36 }); +var matchesAge = _.matches({ 'age': 36 }); -_.filter(characters, matchAge); +_.filter(characters, matchesAge); // => [{ 'name': 'barney', 'age': 36 }] -_.find(characters, matchAge); +_.find(characters, matchesAge); // => { 'name': 'barney', 'age': 36 } ``` @@ -4519,7 +4519,7 @@ _.find(characters, matchAge); ### `_.mixin([object=lodash], source, [options])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L7144 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L7128 "View in source") [Ⓣ][1] Adds function properties of a source object to the destination object. If `object` is a function methods will be added to its prototype as well. @@ -4557,7 +4557,7 @@ _('fred').vowels(); ### `_.noConflict()` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L7204 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L7188 "View in source") [Ⓣ][1] Reverts the '_' variable to its previous value and returns a reference to the `lodash` function. @@ -4577,7 +4577,7 @@ var lodash = _.noConflict(); ### `_.noop()` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L7221 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L7205 "View in source") [Ⓣ][1] A no-operation function. @@ -4596,7 +4596,7 @@ _.noop(object) === undefined; ### `_.parseInt(value, [radix])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L7262 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L7246 "View in source") [Ⓣ][1] Converts `value` to an integer of the specified radix. If `radix` is `undefined` or `0` a `radix` of `10` is used unless the `value` is a hexadecimal, in which case a `radix` of `16` is used. @@ -4623,7 +4623,7 @@ _.parseInt('08'); ### `_.property(key)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L7293 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L7277 "View in source") [Ⓣ][1] Creates a "_.pluck" style function, which returns the `key` value of a given object. @@ -4657,7 +4657,7 @@ _.sortBy(characters, getName); ### `_.random([min=0], [max=1], [floating=false])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L7326 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L7310 "View in source") [Ⓣ][1] Produces a random number between `min` and `max` *(inclusive)*. If only one argument is provided a number between `0` and the given number will be returned. If `floating` is truey or either `min` or `max` are floats a floating-point number will be returned instead of an integer. @@ -4692,7 +4692,7 @@ _.random(1.2, 5.2); ### `_.result(object, key, [defaultValue])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L7391 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L7375 "View in source") [Ⓣ][1] Resolves the value of property `key` on `object`. If `key` is a function it will be invoked with the `this` binding of `object` and its result returned, else the property value is returned. If `object` is `null` or `undefined` then `undefined` is returned. If a default value is provided it will be returned if the property value resolves to `undefined`. @@ -4749,7 +4749,7 @@ Create a new `lodash` function using the given context object. ### `_.times(n, callback, [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L7422 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L7406 "View in source") [Ⓣ][1] Executes the callback `n` times, returning an array of the results of each callback execution. The callback is bound to `thisArg` and invoked with one argument; *(index)*. @@ -4781,7 +4781,7 @@ _.times(3, function(n) { this.cast(n); }, mage); ### `_.uniqueId([prefix])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L7450 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L7434 "View in source") [Ⓣ][1] Generates a unique ID. If `prefix` is provided the ID will be appended to it. @@ -4834,7 +4834,7 @@ A reference to the `lodash` function. ### `_.VERSION` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L7659 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L7643 "View in source") [Ⓣ][1] *(string)*: The semantic version number. diff --git a/lodash.js b/lodash.js index c4ce71502..37b6d89fd 100644 --- a/lodash.js +++ b/lodash.js @@ -7054,12 +7054,12 @@ * { 'name': 'barney', 'age': 36 } * ]; * - * var matchAge = _.matches({ 'age': 36 }); + * var matchesAge = _.matches({ 'age': 36 }); * - * _.filter(characters, matchAge); + * _.filter(characters, matchesAge); * // => [{ 'name': 'barney', 'age': 36 }] * - * _.find(characters, matchAge); + * _.find(characters, matchesAge); * // => { 'name': 'barney', 'age': 36 } */ function matches(source) {