@jagaad/utils
    Preparing search index...

    Function getType

    • Returns the type of a value as a string. This function uses Object.prototype.toString to determine the type of the value. It returns a lowercase string representing the type, such as "string", "number", "boolean", etc.

      getType('hello'); // 'string'
      getType(42); // 'number'
      getType(true); // 'boolean'
      getType([]); // 'array'
      getType({}); // 'object'
      getType(null); // 'null'
      getType(undefined); // 'undefined'
      getType(new Date()); // 'date'
      getType(/regex/); // 'regexp'
      getType(new Map()); // 'map'
      getType(new Set()); // 'set'
      getType(new Promise(() => {}));

      Parameters

      • value: unknown

      Returns string & {} | (keyof TypeMap)