typeOf()

typeOf()

Gets the specific object type of any value.

type-of.func.ts
const typeOf = (value: any): string =>
  Object.prototype.toString.call(value).slice(8, -1).toLowerCase();

Parameters

value: any

The value of any type to obtain its object class name.

Returns

The return value is the object class name of the given value.

Example usage

// Example usage.
import { typeOf } from '@angular-package/type';

Last updated