Logos DX
    Preparing search index...

    Function isPrimitive

    • Checks if value is a primitive type.

      Parameters

      • val: unknown

        value to check

      Returns boolean

      true if value is a primitive type

      isPrimitive(null) // true
      isPrimitive(undefined) // true
      isPrimitive('string') // true
      isPrimitive(1) // true
      isPrimitive(true) // true
      isPrimitive(Symbol('symbol')) // true
      isPrimitive(new Date()) // false
      isPrimitive(new RegExp('')) // false
      isPrimitive(new Error('')) // false
      isPrimitive(new Set()) // false
      isPrimitive(new Map()) // false
      isPrimitive(new Array()) // true
      isPrimitive(new Object()) // true