The
map()method creates a new array populated with the results of calling a provided function on every element in the calling array.(c) MDN
🐊Putout plugin adds ability to remove useless map().
npm i @putout/plugin-remove-useless-map
{
"rules": {
"remove-useless-map": "on"
}
}const [str] = [];
for (const line of lines) {
[str].push(`hello ${line}`);
}
const x = [];
for (const a of array) {
x.push(a);
}
Object
.entries(a)
.map(([a, b]) => [a, b]);const [line] = lines;
const str = `hello ${line}`;
const x = array;MIT