f590e2774b7423056a4de219f3df2df1a05c63490d5ef6124fa7fcac8657787fc482035edc6a6e67694080c3d0a96919a8fc216d3dc6e8e26344928f727a43 658 B

1234567891011121314151617181920212223
  1. /**
  2. * This function is like `baseIndexOf` except that it accepts a comparator.
  3. *
  4. * @private
  5. * @param {Array} array The array to inspect.
  6. * @param {*} value The value to search for.
  7. * @param {number} fromIndex The index to search from.
  8. * @param {Function} comparator The comparator invoked per element.
  9. * @returns {number} Returns the index of the matched value, else `-1`.
  10. */
  11. function baseIndexOfWith(array, value, fromIndex, comparator) {
  12. var index = fromIndex - 1,
  13. length = array.length;
  14. while (++index < length) {
  15. if (comparator(array[index], value)) {
  16. return index;
  17. }
  18. }
  19. return -1;
  20. }
  21. export default baseIndexOfWith;