Ohm-Management - Projektarbeit B-ME
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.

_assocIndexOf.js 487B

123456789101112131415161718192021
  1. var eq = require('./eq');
  2. /**
  3. * Gets the index at which the `key` is found in `array` of key-value pairs.
  4. *
  5. * @private
  6. * @param {Array} array The array to inspect.
  7. * @param {*} key The key to search for.
  8. * @returns {number} Returns the index of the matched value, else `-1`.
  9. */
  10. function assocIndexOf(array, key) {
  11. var length = array.length;
  12. while (length--) {
  13. if (eq(array[length][0], key)) {
  14. return length;
  15. }
  16. }
  17. return -1;
  18. }
  19. module.exports = assocIndexOf;