tguard-js
    Preparing search index...

    Function isPrimitive

    • Checks if a value is a primitive type.

      Parameters

      • x: unknown

        The value to check.

      Returns x is PrimitiveType

      true if the value is a primitive type, otherwise false.

      This function is specifically designed for checking primitive types. A primitive type is a type that is not an object or a function.

      Value Type Result
      null null true
      undefined undefined true
      'hello' string true
      123 number true
      123n bigint true
      true boolean true
      Symbol() symbol true
      [] array false
      {} object false
      function() {} function false

      1.0