🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@putout/plugin-apply-flat-map

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@putout/plugin-apply-flat-map

🐊Putout plugin adds ability to apply 'flatMap()'

3.0.0
latest
Source
npm
Version published
Weekly downloads
4.2K
-18.17%
Maintainers
1
Weekly downloads
 
Created
Source

@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

LinterRuleFix
🐊 Putoutapply-flat-map
ESLintunicorn/prefer-flat-map
🏛 RomeuseFlatMap

License

MIT

Keywords

putout

FAQs

Package last updated on 01 Apr 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts