mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 02:17:50 +00:00
committed by
John-David Dalton
parent
659e8c019c
commit
94c3a8133c
29
lodash.js
29
lodash.js
@@ -9183,6 +9183,10 @@
|
|||||||
* // The `_.property` iteratee shorthand.
|
* // The `_.property` iteratee shorthand.
|
||||||
* _.filter(users, 'active');
|
* _.filter(users, 'active');
|
||||||
* // => objects for ['barney']
|
* // => objects for ['barney']
|
||||||
|
*
|
||||||
|
* // Combining several predicates using `_.overEvery` or `_.overSome`.
|
||||||
|
* _.filter(users, _.overSome([{ 'age': 36 }, ['age', 40]]));
|
||||||
|
* // => objects for ['fred', 'barney']
|
||||||
*/
|
*/
|
||||||
function filter(collection, predicate) {
|
function filter(collection, predicate) {
|
||||||
var func = isArray(collection) ? arrayFilter : baseFilter;
|
var func = isArray(collection) ? arrayFilter : baseFilter;
|
||||||
@@ -15560,6 +15564,9 @@
|
|||||||
* values against any array or object value, respectively. See `_.isEqual`
|
* values against any array or object value, respectively. See `_.isEqual`
|
||||||
* for a list of supported value comparisons.
|
* for a list of supported value comparisons.
|
||||||
*
|
*
|
||||||
|
* **Note:** Multiple values can be checked by combining several matchers
|
||||||
|
* using `_.overSome`
|
||||||
|
*
|
||||||
* @static
|
* @static
|
||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
@@ -15575,6 +15582,10 @@
|
|||||||
*
|
*
|
||||||
* _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
|
* _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
|
||||||
* // => [{ 'a': 4, 'b': 5, 'c': 6 }]
|
* // => [{ 'a': 4, 'b': 5, 'c': 6 }]
|
||||||
|
*
|
||||||
|
* // Checking for several possible values
|
||||||
|
* _.filter(users, _.overSome([_.matches({ 'a': 1 }), _.matches({ 'a': 4 })]));
|
||||||
|
* // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }]
|
||||||
*/
|
*/
|
||||||
function matches(source) {
|
function matches(source) {
|
||||||
return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
|
return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
|
||||||
@@ -15589,6 +15600,9 @@
|
|||||||
* `srcValue` values against any array or object value, respectively. See
|
* `srcValue` values against any array or object value, respectively. See
|
||||||
* `_.isEqual` for a list of supported value comparisons.
|
* `_.isEqual` for a list of supported value comparisons.
|
||||||
*
|
*
|
||||||
|
* **Note:** Multiple values can be checked by combining several matchers
|
||||||
|
* using `_.overSome`
|
||||||
|
*
|
||||||
* @static
|
* @static
|
||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @since 3.2.0
|
* @since 3.2.0
|
||||||
@@ -15605,6 +15619,10 @@
|
|||||||
*
|
*
|
||||||
* _.find(objects, _.matchesProperty('a', 4));
|
* _.find(objects, _.matchesProperty('a', 4));
|
||||||
* // => { 'a': 4, 'b': 5, 'c': 6 }
|
* // => { 'a': 4, 'b': 5, 'c': 6 }
|
||||||
|
*
|
||||||
|
* // Checking for several possible values
|
||||||
|
* _.filter(users, _.overSome([_.matchesProperty('a', 1), _.matchesProperty('a', 4)]));
|
||||||
|
* // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }]
|
||||||
*/
|
*/
|
||||||
function matchesProperty(path, srcValue) {
|
function matchesProperty(path, srcValue) {
|
||||||
return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
|
return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
|
||||||
@@ -15828,6 +15846,10 @@
|
|||||||
* Creates a function that checks if **all** of the `predicates` return
|
* Creates a function that checks if **all** of the `predicates` return
|
||||||
* truthy when invoked with the arguments it receives.
|
* truthy when invoked with the arguments it receives.
|
||||||
*
|
*
|
||||||
|
* Following shorthands are possible for providing predicates.
|
||||||
|
* Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate.
|
||||||
|
* Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them.
|
||||||
|
*
|
||||||
* @static
|
* @static
|
||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @since 4.0.0
|
* @since 4.0.0
|
||||||
@@ -15854,6 +15876,10 @@
|
|||||||
* Creates a function that checks if **any** of the `predicates` return
|
* Creates a function that checks if **any** of the `predicates` return
|
||||||
* truthy when invoked with the arguments it receives.
|
* truthy when invoked with the arguments it receives.
|
||||||
*
|
*
|
||||||
|
* Following shorthands are possible for providing predicates.
|
||||||
|
* Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate.
|
||||||
|
* Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them.
|
||||||
|
*
|
||||||
* @static
|
* @static
|
||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @since 4.0.0
|
* @since 4.0.0
|
||||||
@@ -15873,6 +15899,9 @@
|
|||||||
*
|
*
|
||||||
* func(NaN);
|
* func(NaN);
|
||||||
* // => false
|
* // => false
|
||||||
|
*
|
||||||
|
* var matchesFunc = _.overSome([{ 'a': 1 }, { 'a': 2 }])
|
||||||
|
* var matchesPropertyFunc = _.overSome([['a', 1], ['a', 2]])
|
||||||
*/
|
*/
|
||||||
var overSome = createOver(arraySome);
|
var overSome = createOver(arraySome);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user