/fast-map

A faster array map

Primary LanguageJavaScript

fast-map

Functionally the same as Array.prototype.map() but 5-6x faster by using structuredClone to copy the array.

const fastMap = require('fast-map')

const array = [1, 2, 3, 4]
const newArray = fastMap(array, (num) => num * 2)

// [2, 4, 6, 8]
console.log(newArray)