binded

binded methods as pure functions

Usage no npm install needed!

<script type="module">
  import binded from 'https://cdn.skypack.dev/binded';
</script>

README

binded

NPM version Build Status Coveralls Status Dependency Status

binded methods as pure functions

Install

npm install --save binded

Usage

import binded from 'binded';

const { log, warn } = binded(console);
const { resolve, reject, all } = binded(Promise);

resolve('unicorns').then(log) // unicorns

binded(console); /*
  { log: [Function: bound bound ],
    info: [Function: bound bound ],
    warn: [Function: bound bound ],
    error: [Function: bound bound ],
    dir: [Function: bound bound ],
    time: [Function: bound bound ],
    timeEnd: [Function: bound bound ],
    trace: [Function: bound bound trace],
    assert: [Function: bound bound ],
    Console: [Function: bound Console] } */

binded(Promise); /*
  { resolve: [Function: bound resolve],
    all: [Function: bound all],
    race: [Function: bound race],
    reject: [Function: bound reject] } */

API

binded(input)

Return an Object with functions of methods binded to input, so you can use log from console without it throwing an Error.

input

Required
Type: Function or Object

Function Constructor or an Object.

License

MIT © Vladimir Starkov