UNPKG

shelving

Version:

Toolkit for using data in JavaScript.

20 lines (19 loc) 755 B
import { RequiredError } from "../error/RequiredError.js"; /** Is a value a function? */ export function isFunction(value) { return typeof value === "function"; } /** Assert that a value is a function. */ export function assertFunction(value) { if (typeof value !== "function") throw new RequiredError("Must be function", { received: value, caller: assertFunction }); } /** Function that just passes through the first argument. */ export function PASSTHROUGH(value) { return value; } /** Function that does nothing with its arguments and always returns void. */ // biome-ignore lint/suspicious/noConfusingVoidType: Allow `BLACKHOLE` to be used in places that allow `void` export function BLACKHOLE(...unused) { return undefined; }