@putout/plugin-convert-map-to-for-of
🐊Putout plugin adds ability to convert map to for...of
Last updated 4 years ago by coderaiser .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install @putout/plugin-convert-map-to-for-of 
SYNC missed versions from official npm registry.

@putout/plugin-convert-map-to-for-of NPM version

  • 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

Current Tags

  • 2.0.3                                ...           latest (4 years ago)

7 Versions

  • 2.0.3                                ...           4 years ago
  • 2.0.2                                ...           5 years ago
  • 2.0.1                                ...           5 years ago
  • 2.0.0                                ...           5 years ago
  • 1.1.0                                ...           5 years ago
  • 1.0.1                                ...           5 years ago
  • 1.0.0                                ...           5 years ago
Maintainers (1)
Downloads
Total 10
Today 0
This Week 0
This Month 9
Last Day 0
Last Week 3
Last Month 0
Dependencies (0)
None
Dev Dependencies (6)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE