Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    bind-itpublic

    bind-it Build Status

    convert between data-first/last and ::

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

    Install

    $ npm install --save bind-it
    

    Usage

    import { bindFirst, bindLast } from 'bind-it';
     
    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);
     
     
    const hasPropLast = (prop, data) => !!data[prop];
    const hasThisLast = hasPropLast::bindLast()
     
    assert.strictEqual(data::hasThisLast('name'), true);
    assert.strictEqual(data::hasThisLast('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.

    License

    MIT © Stoeffel

    Keywords

    install

    npm i bind-it

    Downloadsweekly downloads

    2

    version

    1.0.1

    license

    MIT

    repository

    githubgithub

    last publish

    collaborators

    • avatar