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.

_arraySome.js 594B

1234567891011121314151617181920212223
  1. /**
  2. * A specialized version of `_.some` for arrays without support for iteratee
  3. * shorthands.
  4. *
  5. * @private
  6. * @param {Array} [array] The array to iterate over.
  7. * @param {Function} predicate The function invoked per iteration.
  8. * @returns {boolean} Returns `true` if any element passes the predicate check,
  9. * else `false`.
  10. */
  11. function arraySome(array, predicate) {
  12. var index = -1,
  13. length = array == null ? 0 : array.length;
  14. while (++index < length) {
  15. if (predicate(array[index], index, array)) {
  16. return true;
  17. }
  18. }
  19. return false;
  20. }
  21. module.exports = arraySome;