JSPM

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

4.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 6859
  • Score
    100M100P100Q166089F
  • License MIT

🐊Putout plugin adds ability to convert array copy to slice

Package Exports

  • @putout/plugin-convert-array-copy-to-slice
  • @putout/plugin-convert-array-copy-to-slice/lib/convert-array-copy-to-slice.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@putout/plugin-convert-array-copy-to-slice) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@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