_baseIndexOf.js 659B

123456789101112131415161718192021
  1. var baseFindIndex = require('./_baseFindIndex'),
  2. baseIsNaN = require('./_baseIsNaN'),
  3. strictIndexOf = require('./_strictIndexOf');
  4. /**
  5. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  6. *
  7. * @private
  8. * @param {Array} array The array to inspect.
  9. * @param {*} value The value to search for.
  10. * @param {number} fromIndex The index to search from.
  11. * @returns {number} Returns the index of the matched value, else `-1`.
  12. */
  13. function baseIndexOf(array, value, fromIndex) {
  14. return value === value
  15. ? strictIndexOf(array, value, fromIndex)
  16. : baseFindIndex(array, baseIsNaN, fromIndex);
  17. }
  18. module.exports = baseIndexOf;