Function isPrimitive

  • Primary Overload

    PRIMARY

    Determine whether value is a primitive value.

    Parameters

    Returns value is JsonPrimitive

    Remarks

    You can pass String, Boolean, or Number as the primitiveType parameter.

    The overloads to isPrimitive help you narrow the type of a value. They also cause isPrimitive to narrow to never if you pass a JsonObject or JsonArray to it.

    Label

  • Overload

    Parameters

    Returns value is never

    Remarks

    Narrows JsonObject and JsonArray to never. While it probably doesn't make typically make sense to pass a value of a type that's not a JsonObject or JsonArray, this overload reflects the reality of the situation.

  • Overload

    Narrows any JsonValue to a specific type of primitive based upon the PrimitiveClass passed.

    Specified type Narrowed Type
    String string
    Boolean boolean
    Number number
    null null

    Type Parameters

    Parameters

    Returns value is PrimitiveFor<J, JsonValue>

Generated using TypeDoc