UNPKG

pfn

Version:

Possible Function. Wraps what might be a function, with fallback behavior in case it’s not. Perfect for use in functions that accept optional callback arguments.

6 lines (3 loc) 124 B
'use strict' const f = x => typeof x === 'function' module.exports = (x, or = a => a) => f(x) ? x : f(or) ? or : () => or