Skip to content

Latest commit

 

History

History
41 lines (23 loc) · 1.25 KB

readme.md

File metadata and controls

41 lines (23 loc) · 1.25 KB

bind-first Build Status

convert data-first functions into ::-functions

This is a converter function to make a data-first function working with function-bind-operator

Install

$ npm install --save @thisables/bind-first

Usage

import { bindFirst } from '@thisables/bind-first';

const data = { id: 1, name: 'foo' };

const hasPropFirst = (data, prop) => !!data[prop];
const hasThisFirst = hasPropFirst::bindFirst()


assert.strictEqual(data::hasThisFirst('name'), true);
assert.strictEqual(data::hasThisFirst('nope'), false);

:: huh?

If you’re wondering what the :: thing means, you’d better read this excellent overview by @jussi-kalliokoski or have a look at the function bind syntax proposal.

Related

  • bind-last to convert data-last functions into ::-functions

License

MIT © Stoeffel