{"name":"@putout/operator-add-args","version":"15.3.1","type":"module","author":{"name":"coderaiser","email":"mnemonic.enemy@gmail.com","url":"https://github.com/coderaiser"},"description":"🐊Putout operator adds ability to add args to referenced variables that was not defined","homepage":"https://github.com/coderaiser/putout/tree/master/packages/operator-add-args#readme","main":"lib/add-args.js","release":false,"tag":false,"changelog":false,"repository":{"type":"git","url":"git+https://github.com/coderaiser/putout.git"},"scripts":{"test":"madrun test","test:dts":"madrun test:dts","watch:test":"madrun watch:test","lint":"madrun lint","fresh:lint":"madrun fresh:lint","lint:fresh":"madrun lint:fresh","fix:lint":"madrun fix:lint","coverage":"madrun coverage","report":"madrun report","wisdom":"madrun wisdom"},"dependencies":{"@putout/babel":"^5.0.0","@putout/compare":"^19.0.0","@putout/engine-parser":"^15.0.1","@putout/types":"^1.0.0"},"keywords":["putout","putout-operator","operator","add-args"],"devDependencies":{"@putout/eslint-flat":"^4.0.0","@putout/test":"^15.0.0","check-dts":"^1.0.0","eslint":"^10.0.0","eslint-plugin-putout":"^31.0.0","madrun":"^13.0.0","montag":"^2.0.0","nodemon":"^3.0.1","superc8":"^12.0.0","supertape":"^13.0.0"},"peerDependencies":{"putout":">=42"},"license":"MIT","engines":{"node":">=22"},"publishConfig":{"access":"public"},"_id":"@putout/operator-add-args@15.3.1","gitHead":"57965b4595dbe462199e30a1fd11da2041c1b4f2","types":"./lib/add-args.d.ts","bugs":{"url":"https://github.com/coderaiser/putout/issues"},"_nodeVersion":"26.5.0","_npmVersion":"11.4.2","dist":{"integrity":"sha512-lMFee9qme0pQAR+0c2yMkoz4gmq1Ow171GBABHUZgWCICtFCQVuoOsvxs/FopS5Bwmv+zFeSKBQqvvKdM9ZVqw==","shasum":"7d90a460a519a6e35b5950f9e04ac2cd97ea0ce7","tarball":"http://registry-npm.ywwl.com/@putout/operator-add-args/download/@putout/operator-add-args-15.3.1.tgz","fileCount":5,"unpackedSize":10045,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCYCznkA04XuhL+sJ5KP1cdZ0McNZERt5JRoZOvQRGLogIhAO7dulyucjB4tyxJSf+yxd5s1kc56OBPSdLWPBOueggq"}],"size":3500,"noattachment":false,"key":"/@putout/operator-add-args/-/@putout/operator-add-args-15.3.1.tgz"},"_npmUser":{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"},"directories":{},"maintainers":[{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/operator-add-args_15.3.1_1784851892830_0.3890631759319747"},"_hasShrinkwrap":false,"readme":"# @putout/operator-add-args [![NPM version][NPMIMGURL]][NPMURL]\n\n[NPMIMGURL]: https://img.shields.io/npm/v/@putout/operator-add-args.svg?style=flat&longCache=true\n[NPMURL]: https://npmjs.org/package/@putout/operator-add-args \"npm\"\n\n🐊**Putout** operator adds ability to add argument that was not defined before.\n\n## Install\n\n```\nnpm i putout @putout/operator-add-args\n```\n\n## API\n\nIf you want to create 🐊**Putout** `plugin` that will add `args` according to your needs just:\n\n```js\nimport {operator} from 'putout';\nconst {addArgs} = operator;\n\nexport const {\n    report,\n    fix,\n    traverse,\n} = addArgs({\n    comparePlaces: ['{comparePlaces}', 'test(\"__a\", (__args) => __body)'],\n    t: ['{comparePlaces}', [\n        'test(\"__a\", (__args) => __body)',\n        'test.only(\"__a\", (__args) => __body)',\n    ]],\n    maybe: ['{maybe}', [\n        'module.exports.__a = (__args) => __body',\n    ]],\n});\n```\n\nFor couple args it will look this way:\n\n```\nexport const {\n    report,\n    fix,\n    traverse,\n} = addArgs({\n    path: ['vars, path', [\n        '(__a) => __body',\n        '() => __body',\n    ]],\n});\n```\n\nIt will set `vars` if absent, or keep used name.\nIf you have a file `index.spec.js`:\n\n```diff\n-test('', () => {\n+test('', ({comparePlaces}) => {\n    comparePlaces();\n});\n```\n\nPlugin supports options, so you can pass it in `.putout.json`:\n\n```json\n{\n    \"rules\": {\n        \"tape/add-args\": [\"on\", {\n            \"args\": {\n                \"comparePlaces\": [\"{comparePlaces}\", \"test('__a', (__args) => __body)\"]\n            }\n        }]\n    }\n}\n```\n\n### Exclude\n\nIf you want exclude `index.spec.js`:\n\n```diff\ntest('', (path, printer, semantics, {printComment} => {\n    comparePlaces();\n});\n```\n\nYou can use `exclude` list:\n\n```json\n{\n    \"rules\": {\n        \"tape/add-args\": [\"on\", {\n            \"args\": {\n                \"comparePlaces\": [\"{comparePlaces}\", {\n                    \"include\": \"test('__a', (__args) => __body)\",\n                    \"exclude\": [\n                        \"(__a, __b, __c, __object) => __object\"\n                    ]\n                }]\n            }\n        }]\n    }\n}\n```\n\n### `type`\n\nIf you want include only calls, and exclude all other types of nodes, use `type`:\n\n```json\n{\n    \"rules\": {\n        \"tape/add-args\": [\"on\", {\n            \"args\": {\n                \"process\": [\"{process}\", {\n                    \"include\": \"test('__a', (__args) => __body)\",\n                    \"type\": \"call\"\n                }]\n            }\n        }]\n    }\n}\n```\n\nAnd nodes like:\n\n```js\nprocess.hello;\n```\n\nWill be ignored.\n\n## License\n\nMIT\n","publish_time":1784851892969,"_cnpm_publish_time":1784851892969,"dist-tags":{"latest":"15.3.1"}}