arrow-bind

1.0.11 • Public • Published

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" }

Package Sidebar

Install

npm i arrow-bind

Weekly Downloads

1

Version

1.0.11

License

ISC

Unpacked Size

1.59 kB

Total Files

3

Last publish

Collaborators

  • andrewti