958c8d8f58f830701ab1652bdbd27fab7be002ef
[yaffs-website] / node_modules / grunt-legacy-log-utils / node_modules / lodash / _assocIndexOf.js
1 var eq = require('./eq');
2
3 /**
4  * Gets the index at which the first occurrence of `key` is found in `array`
5  * of key-value pairs.
6  *
7  * @private
8  * @param {Array} array The array to search.
9  * @param {*} key The key to search for.
10  * @returns {number} Returns the index of the matched value, else `-1`.
11  */
12 function assocIndexOf(array, key) {
13   var length = array.length;
14   while (length--) {
15     if (eq(array[length][0], key)) {
16       return length;
17     }
18   }
19   return -1;
20 }
21
22 module.exports = assocIndexOf;