@putout/plugin-apply-flat-map
🐊Putout plugin adds ability to apply 'flatMap()'
Last updated 2 years ago by coderaiser .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install @putout/plugin-apply-flat-map 
SYNC missed versions from official npm registry.

@putout/plugin-apply-flat-map NPM version

The flatMap() method returns a new array formed by applying a given callback function to each element of the array, and then flattening the result by one level. It is identical to a map() followed by a flat() of depth 1 (arr.map(...args).flat()), but slightly more efficient than calling those two methods separately.

(c) MDN

🐊Putout plugin adds ability to apply flatMap(). Check out in 🐊Putout Editor.

Install

npm i @putout/plugin-apply-flat-map

Rule

{
    "rules": {
        "apply-flat-map": "on"
    }
}

❌ Example of incorrect code

array.map(getId).flat();

βœ… Example of correct code

array.flatMap(getId);

Comparison

Linter Rule Fix
🐊 Putout apply-flat-map βœ…
⏣ ESLint unicorn/prefer-flat-map βœ…
πŸ› Rome useFlatMap βœ…

License

MIT

Current Tags

  • 2.0.0                                ...           latest (2 years ago)

2 Versions

  • 2.0.0                                ...           2 years ago
  • 1.0.0                                ...           2 years ago
Maintainers (1)
Downloads
Total 0
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (8)
Dependents (1)

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