run-function

0.1.3 • Public • Published

run-function

code style: prettier Dependency Status DevDependency Status Travis Build Status NPM Downloads

Run a function if it exists.

Install

$ npm install run-function

Usage

const runFn = require('run-function');
 
function fn() {
  // do something
}
 
runFn(fn);

API

runFn(fn, ...args)

  • when fn is undefined / null, do nothing;
  • when fn is function, run fn with arguments args;
  • when fn is not undefined / null / function, throw an error;

Package Sidebar

Install

npm i run-function

Weekly Downloads

2

Version

0.1.3

License

MIT

Unpacked Size

3.44 kB

Total Files

4

Last publish

Collaborators

  • m31271n_account