@putout/operator-add-args

8.0.1 • Public • Published

@putout/operator-add-args NPM version

🐊Putout operator adds ability to add argument that was not defined before.

Install

npm i putout @putout/operator-add-args

API

If you want to create 🐊Putout plugin that will add args according to your needs just:

const {operator} = require('putout');
const {addArgs} = operator;

module.exports = addArgs({
    comparePlaces: ['{comparePlaces}', 'test("__a", (__args) => __body)'],
    t: ['{comparePlaces}', [
        'test("__a", (__args) => __body)',
        'test.only("__a", (__args) => __body)',
    ]],
    maybe: ['{maybe}', [
        'module.exports.__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/add-args": ["on", {
            "args": {
                "comparePlaces": ["{comparePlaces}", "test('__a', (__args) => __body)"]
            }
        }]
    }
}

License

MIT

Package Sidebar

Install

npm i @putout/operator-add-args

Weekly Downloads

3,321

Version

8.0.1

License

MIT

Unpacked Size

7.31 kB

Total Files

4

Last publish

Collaborators

  • coderaiser