$ cnpm install @putout/plugin-convert-for-each-to-for-of
The
forEach()method executes a provided function once for each array element.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 forEach() to for...of.
Complements @putout/plugin-convert-const-to-let. Merged to @putout/plugin-for-of.
npm i @putout/plugin-convert-for-each-to-for-of -D
{
"rules": {
"convert-for-each-to-for-of": "on"
}
}
Object.keys(json).forEach((name) => {
manage(name, json[name]);
});
[].forEach.call(arguments, (item) => {
console.log(item);
});
for (const name of Object.keys(json)) {
manage(name, json[name]);
}
for (const name of arguments) {
console.log(item);
}
MIT
Copyright 2013 - present © cnpmjs.org | Home |