Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

overSome.js 1.0KB

12345678910111213141516171819202122232425262728293031323334353637
  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;