poi-starpack

1.0.0 • Public • Published

cast-function

Casts value as a function if it's not one.

Install

$ npm install cast-function

Usage

const castFunction = require('cast-function');

const unicorn = '🦄';
const rainbow = () => '🌈';

console.log(castFunction(unicorn)()); // 🦄
console.log(castFunction(rainbow)()); // 🌈

API

castFunction(value)

Casts value as a function that returns value if it's not one.

License

MIT © Cristian Pallarés

Package Sidebar

Install

npm i poi-starpack

Weekly Downloads

0

Version

1.0.0

License

MIT

Last publish

Collaborators

  • skyrpex