The
push()method ofArrayinstances adds the specified elements to the end of an array and returns the new length of the array.(c) MDN
The
bind()method ofFunctioninstances 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.
npm i @putout/plugin-apply-push
{
"rules": {
"apply-push": "on"
}
}const nextActions = [];
const dispatch = createMiddleware(store)((a) => nextActions.push(a));const nextActions = [];
const push = nextActions.push.bind(nextActions);
const dispatch = createMiddleware(store)(push);MIT