Skip to content

Latest commit

 

History

History
 
 

plugin-convert-concat-to-flat

@putout/plugin-convert-concat-to-flat NPM version

The flat() method creates a new array with all sub-array elements concatenated into it recursively up to the specified depth.

(c) MDN

🐊Putout plugin adds ability to convert concat to flat.

Install

npm i @putout/plugin-convert-concat-to-flat -D

Rule

{
    "rules": {
        "convert-concat-to-flat": "on"
    }
}

❌ Example of incorrect code

[].concat(...array);

✅ Example of correct code

array.flat();

License

MIT