From d1761558b4f141b518fd946706c693b0040271d3 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Wed, 14 Jan 2015 22:30:55 -0800 Subject: [PATCH] Rename `argsToObject` to `arrayToObject` and cleanup `arrayCopy`. --- lodash.src.js | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/lodash.src.js b/lodash.src.js index d545c2b37..80f7e07c5 100644 --- a/lodash.src.js +++ b/lodash.src.js @@ -1404,19 +1404,6 @@ /*------------------------------------------------------------------------*/ - /** - * Converts an `arguments` object to a plain `Object` object. - * - * @private - * @param {Object} args The `arguments` object to convert. - * @returns {Object} Returns the new converted object. - */ - function argsToObject(args) { - var result = { 'length': 0 }; - push.apply(result, args); - return result; - } - /** * Copies the values of `array` to `other`. * @@ -1427,13 +1414,13 @@ */ function arrayCopy(array, other) { var index = -1, - length = array.length, - result = other || Array(length); + length = array.length; + other || (other = Array(length)); while (++index < length) { - result[index] = array[index]; + other[index] = array[index]; } - return result; + return other; } /** @@ -4008,6 +3995,19 @@ return result; } + /** + * Converts `collection` to an array-like object. + * + * @private + * @param {Array|Object|string} collection The collection to convert. + * @returns {Object} Returns the converted array-like object. + */ + function arrayToObject(collection) { + var result = { 'length': 0 }; + push.apply(result, toObject(collection)); + return result; + } + /** * Converts `value` to an array-like object if it is not one. *