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
.
npm i @putout/plugin-convert-concat-to-flat -D
{
"rules": {
"convert-concat-to-flat": "on"
}
}
[].concat(...array);
array.flat();
MIT