Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "utils/native-class/docs/types/index.d"

Index

Functions

Functions

Export assignment nativeClass

  • nativeClass(v: any): string
  • Returns a string value indicating a specification defined classification (via the internal property [[Class]]) of an object.

    Notes

    • The function is not robust for ES2015+ environments. In ES2015+, Symbol.toStringTag allows overriding the default description of an object. While measures are taken to uncover the default description, such measures can be thwarted. While this function remains useful for type-checking, be aware that value impersonation is possible. Where possible, prefer functions tailored to checking for particular value types, as specialized functions are better equipped to address Symbol.toStringTag.

    Parameters

    • v: any

      input value

    Returns string

    string value indicating a specification defined classification of the input value

    Example

    var str = nativeClass( 'a' );
    // returns '[object String]'

    Example

    var str = nativeClass( 5 );
    // returns '[object Number]'

    Example

    function Beep() {
        return this;
    }
    var str = nativeClass( new Beep() );
    // returns '[object Object]'