Use the new operator with the Array constructor.

This commit is contained in:
John-David Dalton
2017-03-07 22:07:04 -08:00
parent 9260bd2f57
commit 5f2a03076d
16 changed files with 16 additions and 16 deletions

View File

@@ -11,7 +11,7 @@ import isArrayLike from '../isArrayLike.js'
*/
function baseMap(collection, iteratee) {
let index = -1
const result = isArrayLike(collection) ? Array(collection.length) : []
const result = isArrayLike(collection) ? new Array(collection.length) : []
baseEach(collection, (value, key, collection) => {
result[++index] = iteratee(value, key, collection)