function.prototype

0.1.1 • Public • Published

function.prototype

Function prototype extensions

Install

This package depends on Node.js.

$ npm install function.prototype

Usage

isGenerator

var fpt = require('function.prototype');

fpt.isGenerator(function * () {}); // true
fpt.isGenerator(function () {}); // false

// or

fpt.isGenerator.shim();

function * () {}.isGenerator(); // true
function () {}.isGenerator(); // false

promisify

var fpt = require('function.prototype');

fpt.promisify(function * (key) { return key }).call(null, 'key').then(function(key) {}, function(err) {});
fpt.promisify(function (key, cb) { cb(null, key) }).call(null, 'key').then(function(key) {}, function(err) {});

// or

fpt.promisify.shim();

function * (key) { return key }.promisify().call(null, 'key').then(function(key) {}, function(err) {});
function (key, cb) { cb(null, key) }.promisify().call(null, 'key').then(function(key) {}, function(err) {});

License

This software is under the MIT license. See the complete license in:

LICENSE

/function.prototype/

    Package Sidebar

    Install

    npm i function.prototype

    Weekly Downloads

    1

    Version

    0.1.1

    License

    MIT

    Unpacked Size

    3.78 kB

    Total Files

    4

    Last publish

    Collaborators

    • cravler