putout operator adds ability to add argument to referenced variables that wan not defined
npm install @putout/operator-add-argument[NPMIMGURL]: https://img.shields.io/npm/v/@putout/operator-add-argument.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/operator-add-argument "npm"
putout operator adds ability to add-argument variable that was not defined before. Renamed to @putout/operator-add-args.
```
npm i putout @putout/operator-add-argument
If you want to create putout plugin that will add-argument variables according to your needs just:
`js
const {operator} = require('putout');
const {addArgument} = operator;
module.exports = addArgument({
comparePlaces: ['{comparePlaces}', 'test("__a", (__args) => __body)'],
});
`
If you have a file index.spec.js:
`diff`
-test('', () => {
+test('', ({comparePlaces}) => {
comparePlaces();
});
Plugin supports options, so you can pass it in .putout.json:
`json``
{
"rules": {
"tape/declare-t": ["on", {
"declarations": {
"comparePlaces": ["{comparePlaces}", "test('__a', (__args) => __body)"]
}
}]
}
}
MIT