@putout/operator-add-argument

1.3.5 • Public • Published

@putout/operator-add-argument NPM version

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

Package Sidebar

Install

npm i @putout/operator-add-argument

Weekly Downloads

14

Version

1.3.5

License

MIT

Unpacked Size

6.39 kB

Total Files

4

Last publish

Collaborators

  • coderaiser