{"name":"@putout/plugin-remove-useless-spread","version":"3.0.0","keywords":["putout","putout-plugin","plugin","spread","useless"],"author":{"url":"https://github.com/coderaiser","name":"coderaiser","email":"mnemonic.enemy@gmail.com"},"license":"MIT","_id":"@putout/plugin-remove-useless-spread@3.0.0","maintainers":[{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"}],"homepage":"http://github.com/coderaiser/putout","bugs":{"url":"https://github.com/coderaiser/putout/issues"},"nyc":{"exclude":["*/**/*.spec.js","test",".*"]},"tag":false,"dist":{"shasum":"58c9b054b52c4e2ec42339b6daf4942e31ac628a","tarball":"http://registry-npm.ywwl.com/@putout/plugin-remove-useless-spread/download/@putout/plugin-remove-useless-spread-3.0.0.tgz","fileCount":6,"integrity":"sha512-z8Oq/4ffeWnBy47f/kS856v22sua7gHQ6IeobPQOXu2OvROswz+eeVWj3FZAV4yIEeCEl8iUjIe4nLy5vJt88w==","signatures":[{"sig":"MEUCIENloJB7OyCVK1qHeMTKUr4mvohTOUqBNlM7NwSTWadkAiEA7K9q7xDoo9qTrbh9h8LSRcHsORSeaFtkPcs0TFur4O4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":3994,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe0RcNCRA9TVsSAnZWagAAgQcP/3dma0Yb+Hv/6TljkvmR\nwmOrbeMDtBJ7W6TcOg+4fvRKwjEUGbQxVybvsAkg2J+45NrFmZ7B/qu4hs3s\nXsLf+5U6vY1a92kSdxX8sd8LKgO99qA+f//NjzsPNlvoI0rybXjEIx/Uq3pQ\n1LV7ZkSJkC/6/tZQpubq0n5cVapoazAvxxLHnzL56PzOdRDStXG/sl9pV+J/\npYYs9VyLKyVB1lY/qmWegDj5ln1Nx8N4gwGoMZpcIZH/PjsQwWR/6BC63/p/\nLCbZgpXQrRL/0fcsKnS3xa8U9GqkUBGT1E79ggjROmwR2MjOBr8FQ+Md5N3h\nE6xlpY+NVdoheKRNZJjadrp6YLROrQ5v7HYJDZUG5iW7iEVh6GFz1noJ/md7\nzi8LDRLou6Q4af2/dVwwS3YkOqTnwY9wKWomN8IpNSlluTiVhe0bD5YX1v8r\n4JecPpKI4YaerD4CO3lr2vUoFQFJlHZvGX9I3oi34gfiR3sZltrhxUq7WNCg\nmrB0OWIwZ+vNnQhO3gxzrxNXAA1Gbq8YxFUUyJcjn6hPrwo+KltQ0q+hfjS8\nxqgdppz6Zkl9tuMvhEf9y3jlplrkD9w3DrV5P49BrPn69Jwhyxmj2bOKNkZP\nFZA7BNX8triaWYbXCSOlXxe+nV/I1bhMPW+HttZKZ+I0Ke7xKYryIu1hqRTO\nf/NE\r\n=7E3R\r\n-----END PGP SIGNATURE-----\r\n","size":1973,"noattachment":false,"key":"/@putout/plugin-remove-useless-spread/-/@putout/plugin-remove-useless-spread-3.0.0.tgz"},"main":"lib/remove-useless-spread.js","engines":{"node":">=8.3.0"},"release":false,"scripts":{"lint":"madrun lint","test":"madrun test","putout":"madrun putout","report":"madrun report","coverage":"madrun coverage","fix:lint":"madrun fix:lint","watch:test":"madrun watch:test","publishOnly":"madrun publishOnly"},"_npmUser":{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"},"changelog":false,"repository":{"url":"git://github.com/coderaiser/putout.git","type":"git"},"_npmVersion":"6.14.4","description":"putout plugin adds ability to remove useless spread","directories":{},"_nodeVersion":"14.3.0","dependencies":{},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"nyc":"^15.0.1","eslint":"^7.0.0-rc.0","madrun":"^6.0.0","coveralls":"^3.0.0","supertape":"^2.0.0","@putout/test":"^2.0.0","eslint-plugin-node":"^11.0.0","@putout/eslint-config":"^1.0.2"},"peerDependencies":{"putout":">=7.7"},"_npmOperationalInternal":{"tmp":"tmp/plugin-remove-useless-spread_3.0.0_1590761229111_0.6199528591790551","host":"s3://npm-registry-packages"},"readme":"# @putout/plugin-remove-useless-spread [![NPM version][NPMIMGURL]][NPMURL]\n\n[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-remove-useless-spread.svg?style=flat&longCache=true\n[NPMURL]: https://npmjs.org/package/@putout/plugin-remove-useless-spread \"npm\"\n\n> **Spread** syntax can be used when all elements from an object or array need to be included in a list of some kind.\n>\n> (c) [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax)\n\n🐊[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to remove useless **spread** syntax.\n\n## Install\n\n```\nnpm i @putout/plugin-remove-useless-spread\n```\n\n## Rule\n\n```json\n{\n    \"rules\": {\n        \"remove-useless-spread/array\": \"on\",\n        \"remove-useless-spread/object\": \"on\",\n        \"remove-useless-spread/nested\": \"on\"\n    }\n}\n```\n\n## array\n\nThe thing is `[...b]` can be used for:\n\n- copying an array;\n- converting different value type like `string` to an `array`.\n\nSo better to be more concrete and use `slice` for copying and `Array()`/`Array.from()` for converting to decrease cognitive load.\nAlso sometimes there is no need on any of this operations, and we can drop `spread`.\n\n### ❌ Example of incorrect code\n\n```js\nfor (const a of [...b]) {}\n\nconst places = [...getPlaces()];\n```\n\n### ✅ Example of correct code\n\n```js\nfor (const a of b) {}\n\nconst places = getPlaces();\n\n// Array constructor creates sparse array\n[...Array(5)].map(Number);\n```\n\n## object\n\n### ❌ Example of incorrect code\n\n```js\nconst a = {\n    ...fn(),\n};\n```\n\n### ✅ Example of correct code\n\n```js\nconst a = fn();\n```\n\n## nested\n\nCheckout in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/60e5a99112affb8a629347e5bf04aedf/38b33f3b5b133897b346a018462c431824e64bb8).\n\n### ❌ Example of incorrect code\n\n```js\n[\n    ...[\n        ...a,\n        ...b,\n    ],\n    ...x,\n];\n```\n\n### ✅ Example of correct code\n\n```js\n[\n    ...a,\n    ...b,\n    ...x,\n];\n```\n\n## License\n\nMIT\n","publish_time":1590761229224,"_cnpm_publish_time":1590761229224,"dist-tags":{"latest":"13.1.1"}}