sfcode
An Online Competing and Development Environment
Function

Function instance

<tt>function/is</tt>

Confirms if given object is a native function

const isFunction = require("type/function/is");
isFunction(function () {}); // true
isFunction(() => {}); // true
isFunction(class {}); // true
isFunction("foo"); // false

<tt>function/ensure</tt>

If given argument is a function object, it is returned back. Otherwise TypeError is thrown.

const ensureFunction = require("type/function/ensure");
const fn = function () {};
ensureFunction(fn); // fn
ensureFunction(/foo/); // Thrown TypeError: /foo/ is not a function