Socket
Socket
Sign inDemoInstall

@putout/plugin-apply-flat-map

Package Overview
Dependencies
389
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @putout/plugin-apply-flat-map

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


Version published
Weekly downloads
3.6K
increased by7.18%
Maintainers
1
Install size
4.19 kB
Created
Weekly downloads
 

Readme

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

FAQs

Last updated on 30 Jan 2023

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc