Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ObjectAccumulator

An implementation of the AbstractAccumulator that accumulates object values

Hierarchy

Index

Constructors

constructor

  • Create an ObjectAccumulator

    Parameters

    • tokeniser: Tokeniser

      the CBOR tokeniser

    • base: JSONPointer

      the base JSON pointer to accumulate from

    • start: number

      the offset of the start token

    • next: number

      the index of the next token

    Returns ObjectAccumulator

Properties

Private Readonly keys

keys: string[] = []

An array of object keys

nextOffset

nextOffset: number

The buffer position of the next token

Private pendingKey

pendingKey: boolean = true

Flag indicating that there is a pending key

Private pendingKeyName

pendingKeyName: string = ""

The pending object key

Readonly startOffset

startOffset: number

The buffer position of the start token

Protected Readonly tokeniser

tokeniser: Tokeniser

The CBOR tokeniser

Methods

accumulated

  • accumulated(): number
  • Get the number of accumulated tokens

    Returns number

    the number of accumulated tokens

add

  • add(tokenEnd: number): boolean
  • inheritdoc

    Parameters

    • tokenEnd: number

    Returns boolean

currentPointer

newArray

  • Create a new ArrayAccumulator from the current token position

    Parameters

    • start: number

      the offset of the start token

    • next: number

      the index of the next token

    Returns ArrayAccumulator

    a new array accumulator

newObject

  • Create a new ObjectAccumulator from the current token position

    Parameters

    • start: number

      the offset of the start token

    • next: number

      the index of the next token

    Returns ObjectAccumulator

    a new object accumulator

notEmptyAndSplitBy

  • notEmptyAndSplitBy(offset: number): boolean
  • Check if the offset splits the accumulator content

    Parameters

    • offset: number

      the offset to check

    Returns boolean

    true if the accumulator has encountered any tokens and the offset is greater than the starting offset

setNextStart

  • setNextStart(offset: number): void
  • Increase the next offset without adding tokens

    Parameters

    • offset: number

    Returns void

skip

  • skip(): void
  • Skip one token

    Returns void

splitStructureEnd

take

  • inheritdoc

    Parameters

    Returns void

takeAll

  • Take all tokens. Passes all accumulated tokens to the abstract take method.

    Parameters

    Returns void

toString

  • toString(): string
  • Convert the accumulator to a string

    Returns string

    a string representation of the accumulator

total

  • total(): number
  • Get the total number of tokens encountered

    Returns number

    the total number of tokens encountered

Copyright © 2025 DiffusionData Ltd. All Rights Reserved.