Skip to content

getTypeOf

Type : function

A function that returns the exact type of a value. It is more precise than the built-in typeof operator and supports more types.

Definition

export function getTypeof(value: any): string {};
  • parameters:

    1. value: any
      • The value to get the type of.
  • returns:

    • "buffer" if the value is an instance of Uint8Array
    • "string" if the value is a string
    • "boolean" if the value is a boolean
    • "undefined" if the value is undefined
    • "function" if the value is a function
    • "number" if the value is a number (excluding NaN)
    • "array" if the value is an array
    • "null" if the value is null
    • "invalid_date" if the value is an invalid Date object
    • "date" if the value is a valid Date object
    • "object" if the value is any other object
    • "unknown" if the value type could not be determined