mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-11 11:27:50 +00:00
Rename _.match to _.matches.
This commit is contained in:
10
lodash.js
10
lodash.js
@@ -691,7 +691,7 @@
|
|||||||
* `curry`, `debounce`, `defaults`, `defer`, `delay`, `difference`, `filter`,
|
* `curry`, `debounce`, `defaults`, `defer`, `delay`, `difference`, `filter`,
|
||||||
* `flatten`, `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`,
|
* `flatten`, `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`,
|
||||||
* `forOwnRight`, `functions`, `groupBy`, `indexBy`, `initial`, `intersection`,
|
* `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`,
|
* `merge`, `min`, `noop`, `object`, `omit`, `once`, `pairs`, `partial`,
|
||||||
* `partialRight`, `pick`, `pluck`, `property`, `pull`, `push`, `range`,
|
* `partialRight`, `pick`, `pluck`, `property`, `pull`, `push`, `range`,
|
||||||
* `reject`, `remove`, `rest`, `reverse`, `shuffle`, `slice`, `sort`, `sortBy`,
|
* `reject`, `remove`, `rest`, `reverse`, `shuffle`, `slice`, `sort`, `sortBy`,
|
||||||
@@ -7016,7 +7016,7 @@
|
|||||||
func || baseCreateCallback(func, thisArg, argCount);
|
func || baseCreateCallback(func, thisArg, argCount);
|
||||||
}
|
}
|
||||||
// handle "_.pluck" and "_.where" style callback shorthands
|
// 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 }
|
* { 'name': 'barney', 'age': 36 }
|
||||||
* ];
|
* ];
|
||||||
*
|
*
|
||||||
* var matchAge = _.match({ 'age': 36 });
|
* var matchAge = _.matches({ 'age': 36 });
|
||||||
*
|
*
|
||||||
* _.filter(characters, matchAge);
|
* _.filter(characters, matchAge);
|
||||||
* // => [{ 'name': 'barney', 'age': 36 }]
|
* // => [{ 'name': 'barney', 'age': 36 }]
|
||||||
@@ -7062,7 +7062,7 @@
|
|||||||
* _.find(characters, matchAge);
|
* _.find(characters, matchAge);
|
||||||
* // => { 'name': 'barney', 'age': 36 }
|
* // => { 'name': 'barney', 'age': 36 }
|
||||||
*/
|
*/
|
||||||
function match(source) {
|
function matches(source) {
|
||||||
source || (source = {});
|
source || (source = {});
|
||||||
|
|
||||||
var props = keys(source),
|
var props = keys(source),
|
||||||
@@ -7476,7 +7476,7 @@
|
|||||||
lodash.keys = keys;
|
lodash.keys = keys;
|
||||||
lodash.map = map;
|
lodash.map = map;
|
||||||
lodash.mapValues = mapValues;
|
lodash.mapValues = mapValues;
|
||||||
lodash.match = match;
|
lodash.matches = matches;
|
||||||
lodash.max = max;
|
lodash.max = max;
|
||||||
lodash.memoize = memoize;
|
lodash.memoize = memoize;
|
||||||
lodash.merge = merge;
|
lodash.merge = merge;
|
||||||
|
|||||||
@@ -5239,17 +5239,17 @@
|
|||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
QUnit.module('lodash.match');
|
QUnit.module('lodash.matches');
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
test('should create a function that performs a deep comparison between a given object and the `props` object', 3, 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 },
|
var object = { 'a': 1, 'b': 2 },
|
||||||
actual = _.match({ 'a': 1 });
|
actual = _.matches({ 'a': 1 });
|
||||||
|
|
||||||
equal(actual.length, 1);
|
equal(actual.length, 1);
|
||||||
strictEqual(actual(object), true);
|
strictEqual(actual(object), true);
|
||||||
|
|
||||||
actual = _.match({ 'b': 1 });
|
actual = _.matches({ 'b': 1 });
|
||||||
strictEqual(actual(object), false);
|
strictEqual(actual(object), false);
|
||||||
});
|
});
|
||||||
}());
|
}());
|
||||||
|
|||||||
Reference in New Issue
Block a user