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.

20 lines
659 B

4 years ago
  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;