Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 

readme.js

/**
 * execute-if-function
 * --------------
 *
 * Execute passed argument if it is a function.
 *
 * `npm install execute-if-function`
 *  or
 * `yarn add execute-if-function`
 *
 * Example:
 * executeIfFunction(someFunction); // will execute function and return result
 * executeIfFunction(someNonFunction); // will just return back someNonFunction
 *
 */

/**
 * @param {*} fn
 * @returns {*}
 */
var executeIfFunction = function executeIfFunction(fn) {
  return typeof fn === 'function' ? fn() : fn;
};

module.exports = executeIfFunction;

About

Execute passed argument if it is a function.

Resources

License

Releases

No releases published

Packages

No packages published
You can’t perform that action at this time.