@putout/plugin-convert-array-copy-to-slice

3.0.0 • Public • Published

@putout/plugin-convert-array-copy-to-slice NPM version

Spread syntax (...) allows an array expression to be expanded in places where elements are expected.

The slice() method returns a shallow copy of a portion of an array into a new array.

(c) MDN

🐊Putout plugin convert spread to slice().

Install

npm i @putout/plugin-convert-array-copy-to-slice -D

Rule

{
    "rules": {
        "convert-array-copy-to-slice": "on"
    }
}

Example of incorrect code

const places = [
    ...items,
];

Example of correct code

const places = items.slice();

License

MIT

Package Sidebar

Install

npm i @putout/plugin-convert-array-copy-to-slice

Weekly Downloads

6,044

Version

3.0.0

License

MIT

Unpacked Size

4.49 kB

Total Files

4

Last publish

Collaborators

  • coderaiser