Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
@skava/modules / ___dist / chain-able / src / deps / array / indexOf.js
Size: Mime:
"use strict";

/**
 * A specialized version of `indexOf` which performs strict equality
 * comparisons of values, i.e. `===`.
 *
 * @memberOf array
 * @since 5.0.0-beta.1
 *
 * @param {Array} array The array to inspect.
 * @param {*} value The value to search for.
 * @param {number} fromIndex The index to search from.
 * @return {number} Returns the index of the matched value, else `-1`.
 *
 * @example
 *
 *    indexOf([10], 10) //=> 0
 *    indexOf([], 10)   //=> -1
 *
 */
function strictIndexOf(array, value, fromIndex) {
  let index = fromIndex - 1;
  const length = array.length;

  while (++index < length) {
    if (array[index] === value) {
      return index;
    }
  }

  return -1;
}

module.exports = strictIndexOf;