{"name":"@putout/operator-add-args","version":"15.0.0","keywords":["putout","putout-operator","operator","add-args"],"author":{"url":"https://github.com/coderaiser","name":"coderaiser","email":"mnemonic.enemy@gmail.com"},"license":"MIT","_id":"@putout/operator-add-args@15.0.0","maintainers":[{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"}],"homepage":"https://github.com/coderaiser/putout/tree/master/packages/operator-add-args#readme","bugs":{"url":"https://github.com/coderaiser/putout/issues"},"tag":false,"dist":{"shasum":"1bfa3da2d9731b3cc9fe9ec6051a1d4a3190cf7a","tarball":"http://registry-npm.ywwl.com/@putout/operator-add-args/download/@putout/operator-add-args-15.0.0.tgz","fileCount":4,"integrity":"sha512-iJ3WXETDX0vBQWO/HxCP66dfzKpyCqa4XirRTh3AvM4UCjWH9N8sdWRHeae+OXyh8b043y4It1OlgJhSKhyWmQ==","signatures":[{"sig":"MEUCIHdmWWk0GOPeCAVBUTXYCxHLKm81P5h08b8X3uv3vaYrAiEAhth6zrYf+kYNK081PhduzyIMIeYQEodAoEcTTZ2ETFM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":9125,"size":3235,"noattachment":false,"key":"/@putout/operator-add-args/-/@putout/operator-add-args-15.0.0.tgz"},"main":"lib/add-args.js","type":"module","engines":{"node":">=22"},"gitHead":"8ee7766721ee95ca7cf2fb138a9a9afdaf1357e4","release":false,"scripts":{"lint":"madrun lint","test":"madrun test","report":"madrun report","coverage":"madrun coverage","fix:lint":"madrun fix:lint","fresh:lint":"madrun fresh:lint","lint:fresh":"madrun lint:fresh","watch:test":"madrun watch:test"},"_npmUser":{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"},"changelog":false,"repository":{"url":"git+https://github.com/coderaiser/putout.git","type":"git"},"_npmVersion":"11.4.2","description":"🐊Putout operator adds ability to add args to referenced variables that was not defined","directories":{},"_nodeVersion":"22.22.0","dependencies":{"@putout/babel":"^5.0.0","@putout/compare":"^19.0.0","@putout/engine-parser":"^15.0.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"c8":"^10.0.0","eslint":"^10.0.0","madrun":"^13.0.0","montag":"^1.2.1","nodemon":"^3.0.1","supertape":"^12.0.0","@putout/test":"^15.0.0","eslint-plugin-n":"^17.0.0","@putout/eslint-flat":"^4.0.0","eslint-plugin-putout":"^31.0.0"},"peerDependencies":{"putout":">=42"},"_npmOperationalInternal":{"tmp":"tmp/operator-add-args_15.0.0_1771604328302_0.8076339842963207","host":"s3://npm-registry-packages-npm-production"},"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":1771604328451,"_cnpm_publish_time":1771604328451,"dist-tags":{"latest":"15.3.1"}}