{ "_args": [ [ { "raw": "babel-plugin-syntax-trailing-function-commas@^6.5.0", "scope": null, "escapedName": "babel-plugin-syntax-trailing-function-commas", "name": "babel-plugin-syntax-trailing-function-commas", "rawSpec": "^6.5.0", "spec": ">=6.5.0 <7.0.0", "type": "range" }, "/home/jdaugherty/work/GT2/GT2-Android/node_modules/babel-preset-react-native" ] ], "_from": "babel-plugin-syntax-trailing-function-commas@>=6.5.0 <7.0.0", "_id": "babel-plugin-syntax-trailing-function-commas@6.22.0", "_inCache": true, "_location": "/babel-plugin-syntax-trailing-function-commas", "_nodeVersion": "6.9.0", "_npmOperationalInternal": { "host": "packages-12-west.internal.npmjs.com", "tmp": "tmp/babel-plugin-syntax-trailing-function-commas-6.22.0.tgz_1484872420863_0.6671405488159508" }, "_npmUser": { "name": "hzoo", "email": "hi@henryzoo.com" }, "_npmVersion": "3.10.10", "_phantomChildren": {}, "_requested": { "raw": "babel-plugin-syntax-trailing-function-commas@^6.5.0", "scope": null, "escapedName": "babel-plugin-syntax-trailing-function-commas", "name": "babel-plugin-syntax-trailing-function-commas", "rawSpec": "^6.5.0", "spec": ">=6.5.0 <7.0.0", "type": "range" }, "_requiredBy": [ "/babel-preset-fbjs", "/babel-preset-react-native", "/react-native" ], "_resolved": "https://registry.npmjs.org/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-6.22.0.tgz", "_shasum": "ba0360937f8d06e40180a43fe0d5616fff532cf3", "_shrinkwrap": null, "_spec": "babel-plugin-syntax-trailing-function-commas@^6.5.0", "_where": "/home/jdaugherty/work/GT2/GT2-Android/node_modules/babel-preset-react-native", "dependencies": {}, "description": "Compile trailing function commas to ES5", "devDependencies": { "babel-helper-plugin-test-runner": "^6.22.0" }, "directories": {}, "dist": { "shasum": "ba0360937f8d06e40180a43fe0d5616fff532cf3", "tarball": "https://registry.npmjs.org/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-6.22.0.tgz" }, "keywords": [ "babel-plugin" ], "license": "MIT", "main": "lib/index.js", "maintainers": [ { "name": "amasad", "email": "amjad.masad@gmail.com" }, { "name": "hzoo", "email": "hi@henryzoo.com" }, { "name": "jmm", "email": "npm-public@jessemccarthy.net" }, { "name": "loganfsmyth", "email": "loganfsmyth@gmail.com" }, { "name": "sebmck", "email": "sebmck@gmail.com" }, { "name": "thejameskyle", "email": "me@thejameskyle.com" } ], "name": "babel-plugin-syntax-trailing-function-commas", "optionalDependencies": {}, "readme": "# babel-plugin-syntax-trailing-function-commas\n\nCompile trailing function commas to ES5\n\n\n```js\nfunction clownPuppiesEverywhere(\n param1,\n param2,\n) { /* ... */ }\n\nclownPuppiesEverywhere(\n 'foo',\n 'bar',\n);\n```\n[Try in REPL](http://babeljs.io/repl/#?evaluate=true&presets=es2015%2Cstage-0&code=function%20clownPuppiesEverywhere(%0A%20%20param1%2C%0A%20%20param2%2C%0A)%20%7B%20%2F*%20...%20*%2F%20%7D%0A%0AclownPuppiesEverywhere(%0A%20%20'foo'%2C%0A%20%20'bar'%2C%0A)%3B)\n\n## Example\n\n### Basic\nThis is an example from the [Proposal](https://github.com/jeffmo/es-trailing-function-commas).\n\nLet's say you have this function:\n\n```js\nfunction clownPuppiesEverywhere(\n param1,\n param2\n) { /* ... */ }\n\nclownPuppiesEverywhere(\n 'foo',\n 'bar'\n);\n```\n\nIf you want to have a new parameter called `param3`, the diff output would be like that:\n\n```diff\nfunction clownPuppiesEverywhere(\n param1,\n- param2\n+ param2, // Change this line to add a comma\n+ param3 // Add param3\n) { /* ... */ }\n\nclownPuppiesEverywhere(\n 'foo',\n- 'bar'\n+ 'bar', // Change this line to add a comma\n+ 'baz' // Add param3\n);\n```\nIn total, you have to change 2 lines for the function declaration and 2 lines for each usage.\n\nIf you had your function defined with trailing commas:\n\n```js\nfunction clownPuppiesEverywhere(\n param1,\n param2,\n) { /* ... */ }\n\nclownPuppiesEverywhere(\n 'foo',\n 'bar',\n);\n```\nAdding a new parameter would only change one line in the function declaration and one line for each usage:\n\n```diff\nfunction clownPuppiesEverywhere(\n param1,\n param2,\n+ param3, // Add param3\n) { /* ... */ }\n\nclownPuppiesEverywhere(\n 'foo',\n 'bar',\n+ 'baz', // Add param3\n);\n```\nIn the end, your diff output will be cleaner and easier to read, it would be much quicker to add a new parameter to your functions, it also makes it easier to copy paste elements and move code around.\n\n## Installation\n\n```sh\nnpm install --save-dev babel-plugin-syntax-trailing-function-commas\n```\n\n## Usage\n\n### Via `.babelrc` (Recommended)\n\n**.babelrc**\n\n```json\n{\n \"plugins\": [\"syntax-trailing-function-commas\"]\n}\n```\n\n### Via CLI\n\n```sh\nbabel --plugins syntax-trailing-function-commas script.js\n```\n\n### Via Node API\n\n```javascript\nrequire(\"babel-core\").transform(\"code\", {\n plugins: [\"syntax-trailing-function-commas\"]\n});\n```\n\n## References\n\n* [Proposal](https://github.com/jeffmo/es-trailing-function-commas)\n* [Spec](http://jeffmo.github.io/es-trailing-function-commas/)\n* [Why you should enforce Dangling Commas for Multiline Statements](https://medium.com/@nikgraf/why-you-should-enforce-dangling-commas-for-multiline-statements-d034c98e36f8)\n", "readmeFilename": "README.md", "repository": { "type": "git", "url": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-trailing-function-commas" }, "scripts": {}, "version": "6.22.0" }