Move assocIndexOf closer to other assoc functions.

This commit is contained in:
John-David Dalton
2015-10-04 14:40:00 -07:00
parent 592824781c
commit 2740dc5efa

View File

@@ -635,25 +635,6 @@
}
}
/**
* Gets the index at which the first occurrence of `key` is found in `array`
* of key-value pairs.
*
* @private
* @param {Array} array The array to search.
* @param {*} key The key to search for.
* @returns {number} Returns the index of the matched value, else `-1`.
*/
function assocIndexOf(array, key) {
var length = array.length;
while (length--) {
if (array[length][0] === key) {
return length;
}
}
return -1;
}
/**
* The base implementation of methods like `_.find` and `_.findKey` without
* support for callback shorthands, which iterates over `collection` using
@@ -2068,6 +2049,25 @@
return assocIndexOf(array, key) > -1;
}
/**
* Gets the index at which the first occurrence of `key` is found in `array`
* of key-value pairs.
*
* @private
* @param {Array} array The array to search.
* @param {*} key The key to search for.
* @returns {number} Returns the index of the matched value, else `-1`.
*/
function assocIndexOf(array, key) {
var length = array.length;
while (length--) {
if (array[length][0] === key) {
return length;
}
}
return -1;
}
/**
* Sets the associative array `key` to `value`.
*