Socket
Book a DemoInstallSign in
Socket

exec-fn

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

exec-fn

Execute function, promise, generator and get a consistent result

latest
Source
npmnpm
Version
1.0.1
Version published
Weekly downloads
4
300%
Maintainers
1
Weekly downloads
 
Created
Source

exec-fn Circle CI

Execute function, promise, generator and get a consistent result.

Installation

$ npm install exec-fn --save

Usage

const execute = require('exec-fn');

function regularFn () {
  return 'regular';
}

function promiseFn () {
  return Promise.resolve('promise');
}

function * generatorFn () {
  return 'generator';
}

exec(regularFn).then(function (value) {
  value === 'regular';
});

exec(promiseFn).then(function (value) {
  value === 'promise';
});

exec(generatorFn).then(function (value) {
  value === 'generator';
});

API

exec(fn, arguments, context)
  • fn - function to execute. Can be a regular function, generator function or function that returns a Promise.
  • arguments - array of arguments for the fn (optional)
  • context - context for the fn (optional)

Tests

Circle CI

$ make test

License

MIT © vdemedes

FAQs

Package last updated on 21 Sep 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts