Skip to content

gaslamp


Function: getTypeOf()

getTypeOf(value): string

Get the type name of any value using Symbol.toStringTag for custom types and Object.prototype.toString for standard JS types.

Recognizes gaslamp classes (BareFrame, FlameFrame, GroupedFrame, LazyFrame, ForgeFrame, Expression), GAS types (Sheet, Spreadsheet, etc.), and standard JS types (string, number, array, date, map, set, etc.).

Parameters

value

unknown

Value to inspect

Returns

string

Type name as a lowercase string

Example

TypeScript
getTypeOf("hello");                    // "string"
getTypeOf([1, 2, 3]);                  // "array"
getTypeOf(new Date());                 // "date"
getTypeOf(new BareFrame(...));         // "bareframe"
getTypeOf(new FlameFrame(...));        // "flameframe"
getTypeOf(new GroupedFrame(...));      // "groupedframe"
getTypeOf(new LazyFrame(...));         // "lazyframe"
getTypeOf(new ForgeFrame(...));        // "forgeframe"
getTypeOf(new Expression('col'));      // "expression"
getTypeOf(null);                       // "null"

Since

0.37.0