mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-03 00:27:50 +00:00
Use the new operator with the Array constructor.
This commit is contained in:
@@ -26,7 +26,7 @@ import isArrayLike from './isArrayLike.js'
|
||||
function invokeMap(collection, path, args) {
|
||||
let index = -1
|
||||
const isFunc = typeof path == 'function'
|
||||
const result = isArrayLike(collection) ? Array(collection.length) : []
|
||||
const result = isArrayLike(collection) ? new Array(collection.length) : []
|
||||
|
||||
baseEach(collection, (value) => {
|
||||
result[++index] = isFunc ? path.apply(value, args) : invoke(value, path, args)
|
||||
|
||||
Reference in New Issue
Block a user