You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
1.0 KiB

пре 4 година
  1. var arraySome = require('./_arraySome'),
  2. createOver = require('./_createOver');
  3. /**
  4. * Creates a function that checks if **any** of the `predicates` return
  5. * truthy when invoked with the arguments it receives.
  6. *
  7. * Following shorthands are possible for providing predicates.
  8. * Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate.
  9. * Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them.
  10. *
  11. * @static
  12. * @memberOf _
  13. * @since 4.0.0
  14. * @category Util
  15. * @param {...(Function|Function[])} [predicates=[_.identity]]
  16. * The predicates to check.
  17. * @returns {Function} Returns the new function.
  18. * @example
  19. *
  20. * var func = _.overSome([Boolean, isFinite]);
  21. *
  22. * func('1');
  23. * // => true
  24. *
  25. * func(null);
  26. * // => true
  27. *
  28. * func(NaN);
  29. * // => false
  30. *
  31. * var matchesFunc = _.overSome([{ 'a': 1 }, { 'a': 2 }])
  32. * var matchesPropertyFunc = _.overSome([['a', 1], ['a', 2]])
  33. */
  34. var overSome = createOver(arraySome);
  35. module.exports = overSome;