UNPKG

hkt-toolbelt

Version:

Functional and composable type utilities

22 lines (21 loc) 617 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.typeOf = void 0; /** * `typeOf` is the runtime counterpart to `Type.TypeOf`. * It simply calls `typeof` on the given value. * * @param x - The value to determine the type of. * @returns A string representing the runtime type of `x`. * * @example * ```ts * import { Type } from 'hkt-toolbelt' * * console.log(typeOf("hello")) // "string" * console.log(typeOf(123)) // "number" * console.log(typeOf(null)) // "object" * console.log(typeOf(undefined)) // "undefined" * ``` */ exports.typeOf = ((x) => typeof x);