Class Int32

A class representation of a BSON Int32 type.

Hierarchy (view full)

Constructors

Properties

Accessors

Methods

Constructors

  • Create an Int32 type

    Parameters

    • value: string | number

      the number we want to represent as an int32.

    Returns Int32

Properties

value: number

Accessors

  • get _bsontype(): "Int32"
  • Returns "Int32"

Methods

  • Prints a human-readable string of BSON value information If invoked manually without node.js.inspect function, this will default to a modified JSON.stringify

    Parameters

    • Optionaldepth: number
    • Optionaloptions: unknown
    • Optionalinspect: InspectFn

    Returns string

  • Returns number

  • Returns a string representation of an object.

    Parameters

    • Optionalradix: number

    Returns string

  • Access the number value.

    Returns number

    returns the wrapped int32 number.

  • Attempt to create an Int32 type from string.

    This method will throw a BSONError on any string input that is not representable as an Int32. Notably, this method will also throw on the following string formats:

    • Strings in non-decimal formats (exponent notation, binary, hex, or octal digits)
    • Strings non-numeric and non-leading sign characters (ex: '2.0', '24,000')
    • Strings with leading and/or trailing whitespace

    Strings with leading zeros, however, are allowed.

    Parameters

    • value: string

      the string we want to represent as an int32.

    Returns Int32