Casts value as a function if it's not one.
$ npm install cast-function
const castFunction = require('cast-function');
const unicorn = 'π¦';
const rainbow = () => 'π';
console.log(castFunction(unicorn)()); // π¦
console.log(castFunction(rainbow)()); // π
Casts value as a function that returns value if it's not one.
MIT Β© Cristian PallarΓ©s