_arrayIncludes.js 526 B

123456789101112131415161718
  1. var baseIndexOf = require('./_baseIndexOf');
  2. /**
  3. * A specialized version of `_.includes` for arrays without support for
  4. * specifying an index to search from.
  5. *
  6. * @private
  7. * @param {Array} [array] The array to inspect.
  8. * @param {*} target The value to search for.
  9. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  10. */
  11. function arrayIncludes(array, value) {
  12. var length = array == null ? 0 : array.length;
  13. return !!length && baseIndexOf(array, value, 0) > -1;
  14. }
  15. module.exports = arrayIncludes;