Home > yorkie-js-sdk > Primitive

Primitive class

Primitive represents primitive data type including logical clock. This is immutable.


export declare class Primitive 


Constructor Modifiers Description
(constructor)(value, createdAt)   Constructs a new instance of the Primitive class


Method Modifiers Description
deepcopy()   deepcopy copies itself deeply.
getPrimitiveType(value) static getPrimitiveType returns the primitive type of the value.
getType()   getType returns the type of the value.
getValue()   getValue returns the value of Primitive.
isInteger(num) static isInteger checks if the given number is integer.
isNumericType()   isNumericType checks numeric type by JSONPrimitive
isSupport(value) static isSupport check if the given value is supported type.
of(value, createdAt) static of creates a new instance of Primitive.
toBytes()   toBytes creates an array representing the value.
toJSON()   toJSON returns the JSON encoding of the value.
toSortedJSON()   toSortedJSON returns the sorted JSON encoding of the value.
valueFromBytes(primitiveType, bytes) static valueFromBytes parses the given bytes into value.