Skip to content

Latest commit

 

History

History

README.md

@putout/plugin-apply-push NPM version

The push() method of Array instances adds the specified elements to the end of an array and returns the new length of the array.

(c) MDN

The bind() method of Function instances creates a new function that, when called, calls this function with its this keyword set to the provided value, and a given sequence of arguments preceding any provided when the new function is called.

(c) MDN

🐊Putout plugin adds ability to apply push() bind.

Checkout in 🐊Putout Editor.

Install

npm i @putout/plugin-apply-push

Rule

{
    "rules": {
        "apply-push": "on"
    }
}

❌ Example of incorrect code

const nextActions = [];
const dispatch = createMiddleware(store)((a) => nextActions.push(a));

✅ Example of correct code

const nextActions = [];
const push = nextActions.push.bind(nextActions);
const dispatch = createMiddleware(store)(push);

License

MIT