mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-10 19:07:49 +00:00
Simplify _.where but don't make it an official alias of _.filter.
Former-commit-id: 794ab4eb814e8872443e282beb32cc636dedc43a
This commit is contained in:
15
build.js
15
build.js
@@ -621,7 +621,7 @@
|
|||||||
* @returns {String} Returns the method name's category.
|
* @returns {String} Returns the method name's category.
|
||||||
*/
|
*/
|
||||||
function getCategory(source, methodName) {
|
function getCategory(source, methodName) {
|
||||||
var result = /@category *(\w+)/.exec(matchFunction(source, methodName));
|
var result = /@category +(\w+)/.exec(matchFunction(source, methodName));
|
||||||
return result ? result[1] : '';
|
return result ? result[1] : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -816,7 +816,18 @@
|
|||||||
')\\n'
|
')\\n'
|
||||||
));
|
));
|
||||||
|
|
||||||
return result ? result[0] : '';
|
if (result) {
|
||||||
|
return result[0];
|
||||||
|
}
|
||||||
|
// match variables that are explicitly defined as functions
|
||||||
|
result = source.match(RegExp(
|
||||||
|
// match multi-line comment block
|
||||||
|
'(?:\\n +/\\*[^*]*\\*+(?:[^/][^*]*\\*+)*/)?\\n' +
|
||||||
|
// match a simple variable declaration
|
||||||
|
' *var ' + funcName + ' *=.+?;\\n'
|
||||||
|
));
|
||||||
|
|
||||||
|
return /@type +Function/.test(result) ? result[0] : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -2944,9 +2944,7 @@
|
|||||||
* _.where(stooges, { 'age': 40 });
|
* _.where(stooges, { 'age': 40 });
|
||||||
* // => [{ 'name': 'moe', 'age': 40 }]
|
* // => [{ 'name': 'moe', 'age': 40 }]
|
||||||
*/
|
*/
|
||||||
function where(collection, properties) {
|
var where = filter;
|
||||||
return filter(collection, properties);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user