@putout/plugin-convert-map-to-for-of
v2.0.3
Published
šPutout plugin adds ability to convert map to for...of
Downloads
7,950
Maintainers
Readme
@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...of
statement 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
.
Install
npm i @putout/plugin-convert-map-to-for-of -D
Rule
{
"rules": {
"convert-map-to-for-of": "on"
}
}
ā Example of incorrect code
names.map((name) => {
alert(`hello ${name}`);
});
ā Example of correct code
for (const name of names) {
alert(`hello ${name}`);
}
License
MIT