tguard-js
    Preparing search index...

    Function isClass

    • Determines whether the provided value is an ES6 class constructor.

      Note:
      Native constructors (URL, Map, etc.) are runtime-dependent and may yield different results across environments.

      This behavior is due to engine implementation differences and cannot be fully normalized without sacrificing correctness.

      Parameters

      • x: unknown

        The value to be checked.

      Returns x is new (...args: any[]) => unknown

      true if the value is an ES6 class constructor, otherwise false.

      This function uses Function.prototype.toString() to check if the value is a class constructor but it is unstable for native constructors.

      Value Result (Typical)
      class {} true
      class A extends B {} true
      function () {} false
      function () {}.bind() false
      () => {} false
      {} false
      URL runtime-dependent

      1.0