@putout/operator-add-argument
putout
operator adds ability to add-argument variable that was not defined before. Renamed to @putout/operator-add-args.
Install
npm i putout @putout/operator-add-argument
API
If you want to create putout plugin
that will add-argument variables according to your needs just:
const {operator} = require('putout');
const {addArgument} = operator;
module.exports = addArgument({
comparePlaces: ['{comparePlaces}', 'test("__a", (__args) => __body)'],
});
If you have a file index.spec.js
:
-test('', () => {
+test('', ({comparePlaces}) => {
comparePlaces();
});
Plugin supports options, so you can pass it in .putout.json
:
{
"rules": {
"tape/declare-t": ["on", {
"declarations": {
"comparePlaces": ["{comparePlaces}", "test('__a', (__args) => __body)"]
}
}]
}
}
License
MIT