diff --git a/.internal/arrayPush.js b/.internal/arrayPush.js deleted file mode 100644 index cd09d83ab..000000000 --- a/.internal/arrayPush.js +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Appends the elements of `values` to `array`. - * - * @private - * @param {Array} array The array to modify. - * @param {Array} values The values to append. - * @returns {Array} Returns `array`. - */ -function arrayPush(array, values) { - let index = -1 - const length = values.length - const offset = array.length - - while (++index < length) { - array[offset + index] = values[index] - } - return array -} - -export default arrayPush diff --git a/.internal/baseFlatten.js b/.internal/baseFlatten.js index 37e8bf124..f1eb13169 100644 --- a/.internal/baseFlatten.js +++ b/.internal/baseFlatten.js @@ -1,4 +1,3 @@ -import arrayPush from './arrayPush.js' import isFlattenable from './isFlattenable.js' /** @@ -26,7 +25,7 @@ function baseFlatten(array, depth, predicate, isStrict, result) { // Recursively flatten arrays (susceptible to call stack limits). baseFlatten(value, depth - 1, predicate, isStrict, result) } else { - arrayPush(result, value) + result.push(...value) } } else if (!isStrict) { result[result.length] = value diff --git a/.internal/getAllKeys.js b/.internal/getAllKeys.js index d681be391..6c11a587b 100644 --- a/.internal/getAllKeys.js +++ b/.internal/getAllKeys.js @@ -1,4 +1,3 @@ -import arrayPush from './arrayPush.js' import getSymbols from './getSymbols.js' import keys from '../keys.js' @@ -11,7 +10,10 @@ import keys from '../keys.js' */ function getAllKeys(object) { const result = keys(object) - return Array.isArray(object) ? result : arrayPush(result, getSymbols(object)) + if (!Array.isArray(object)) { + result.push(...getSymbols(object)) + } + return result } export default getAllKeys diff --git a/.internal/getAllKeysIn.js b/.internal/getAllKeysIn.js index d1eaf8c8b..747629873 100644 --- a/.internal/getAllKeysIn.js +++ b/.internal/getAllKeysIn.js @@ -1,10 +1,8 @@ -import arrayPush from './arrayPush.js' import getSymbolsIn from './getSymbolsIn.js' import keysIn from '../keysIn.js' /** - * Creates an array of own and inherited enumerable property names and - * symbols of `object`. + * Creates an array of own and inherited enumerable property names and symbols of `object`. * * @private * @param {Object} object The object to query. @@ -12,7 +10,10 @@ import keysIn from '../keysIn.js' */ function getAllKeysIn(object) { const result = keysIn(object) - return Array.isArray(object) ? result : arrayPush(result, getSymbolsIn(object)) + if (!Array.isArray(object)) { + result.push(...getSymbolsIn(object)) + } + return result } export default getAllKeysIn diff --git a/.internal/getSymbolsIn.js b/.internal/getSymbolsIn.js index 4aff23d8c..8ce8c8723 100644 --- a/.internal/getSymbolsIn.js +++ b/.internal/getSymbolsIn.js @@ -1,4 +1,3 @@ -import arrayPush from './arrayPush.js' import getSymbols from './getSymbols.js' /* Built-in method references for those with the same name as other `lodash` methods. */ @@ -14,7 +13,7 @@ const nativeGetSymbols = Object.getOwnPropertySymbols const getSymbolsIn = !nativeGetSymbols ? () => [] : object => { const result = [] while (object) { - arrayPush(result, getSymbols(object)) + result.push(...getSymbols(object)) object = Object.getPrototypeOf(Object(object)) } return result