Rename _.match to _.matches.

This commit is contained in:
John-David Dalton
2014-02-10 23:02:01 -08:00
parent 7faaac94dd
commit f090af2292
2 changed files with 8 additions and 8 deletions

View File

@@ -691,7 +691,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`,
@@ -7016,7 +7016,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);
}
/**
@@ -7054,7 +7054,7 @@
* { 'name': 'barney', 'age': 36 }
* ];
*
* var matchAge = _.match({ 'age': 36 });
* var matchAge = _.matches({ 'age': 36 });
*
* _.filter(characters, matchAge);
* // => [{ 'name': 'barney', 'age': 36 }]
@@ -7062,7 +7062,7 @@
* _.find(characters, matchAge);
* // => { 'name': 'barney', 'age': 36 }
*/
function match(source) {
function matches(source) {
source || (source = {});
var props = keys(source),
@@ -7476,7 +7476,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;

View File

@@ -5239,17 +5239,17 @@
/*--------------------------------------------------------------------------*/
QUnit.module('lodash.match');
QUnit.module('lodash.matches');
(function() {
test('should create a function that performs a deep comparison between a given object and the `props` object', 3, function() {
var object = { 'a': 1, 'b': 2 },
actual = _.match({ 'a': 1 });
actual = _.matches({ 'a': 1 });
equal(actual.length, 1);
strictEqual(actual(object), true);
actual = _.match({ 'b': 1 });
actual = _.matches({ 'b': 1 });
strictEqual(actual(object), false);
});
}());