1.0.11 • Published 5 years ago

arrow-bind v1.0.11

Weekly downloads
3
License
ISC
Repository
github
Last release
5 years ago

Easy bind a context to an arrow function:)

const { bindArrow } = require('arrow-bind');
// OR
import { bindArrow } from 'arrow-bind';

const arrowFunc = () => console.log(this);
arrowFunc() // window

const newContext = { event: "changed context" };

const arrowChCx = bindArrow(arrowFunc, newContext);
arrowChCx() // { event: "changed context" }