main
Last change
on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
1.0 KB
|
Rev | Line | |
---|
[d565449] | 1 | import arraySome from './_arraySome.js';
|
---|
| 2 | import createOver from './_createOver.js';
|
---|
| 3 |
|
---|
| 4 | /**
|
---|
| 5 | * Creates a function that checks if **any** of the `predicates` return
|
---|
| 6 | * truthy when invoked with the arguments it receives.
|
---|
| 7 | *
|
---|
| 8 | * Following shorthands are possible for providing predicates.
|
---|
| 9 | * Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate.
|
---|
| 10 | * Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them.
|
---|
| 11 | *
|
---|
| 12 | * @static
|
---|
| 13 | * @memberOf _
|
---|
| 14 | * @since 4.0.0
|
---|
| 15 | * @category Util
|
---|
| 16 | * @param {...(Function|Function[])} [predicates=[_.identity]]
|
---|
| 17 | * The predicates to check.
|
---|
| 18 | * @returns {Function} Returns the new function.
|
---|
| 19 | * @example
|
---|
| 20 | *
|
---|
| 21 | * var func = _.overSome([Boolean, isFinite]);
|
---|
| 22 | *
|
---|
| 23 | * func('1');
|
---|
| 24 | * // => true
|
---|
| 25 | *
|
---|
| 26 | * func(null);
|
---|
| 27 | * // => true
|
---|
| 28 | *
|
---|
| 29 | * func(NaN);
|
---|
| 30 | * // => false
|
---|
| 31 | *
|
---|
| 32 | * var matchesFunc = _.overSome([{ 'a': 1 }, { 'a': 2 }])
|
---|
| 33 | * var matchesPropertyFunc = _.overSome([['a', 1], ['a', 2]])
|
---|
| 34 | */
|
---|
| 35 | var overSome = createOver(arraySome);
|
---|
| 36 |
|
---|
| 37 | export default overSome;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.