@putout/plugin-convert-for-each-to-for-of 
🐊Putout
plugin adds ability to convert Math.pow
to exponentiation operator
.
Install
npm i @putout/plugin-convert-for-each-to-for-of -D
Rule
Rule convert-for-each-to-for-of
is enabled by default, to disable add to .putout.json
:
{
"rules": {
"convert-for-each-to-for-of": "off"
}
}
❌ Incorrect code example
Object.keys(json).forEach((name) => {
manage(name, json[name]);
});
[].forEach.call(arguments, (item) => {
console.log(item);
});
✅ Correct code Example
for (const name of Object.keys(json)) {
manage(name, json[name]);
}
for (const name of arguments) {
console.log(item);
}
License
MIT