From 2740dc5efae9630c2b49e7185b32be355f9d18ee Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sun, 4 Oct 2015 14:40:00 -0700 Subject: [PATCH] Move `assocIndexOf` closer to other `assoc` functions. --- lodash.js | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/lodash.js b/lodash.js index 683b27cb0..113070b5b 100644 --- a/lodash.js +++ b/lodash.js @@ -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`. *