$ cnpm install @putout/plugin-convert-map-to-for-of
The
map()method creates a new array populated with the results of calling a provided function on every element in the calling array.The
for...ofstatement creates a loop which invokes a custom iteration hook with statements to be executed for the value of each element of an array.(c) MDN
????Putout plugin adds ability to convert map to for...of loop. Merged to @putout/plugin-for-of.
npm i @putout/plugin-convert-map-to-for-of -D
{
"rules": {
"convert-map-to-for-of": "on"
}
}
names.map((name) => {
alert(`hello ${name}`);
});
for (const name of names) {
alert(`hello ${name}`);
}
MIT
Copyright 2013 - present © cnpmjs.org | Home |