All files / json-pack/src/ion IonDecoder.ts

90% Statements 9/10
100% Branches 0/0
50% Functions 1/2
90% Lines 9/10

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 274x 4x 4x     4x   2140x     2140x     2140x     2140x     2140x              
import {IonDecoderBase} from './IonDecoderBase';
import {Import} from './Import';
import {systemSymbolImport} from './symbols';
import type {IReader, IReaderResettable} from '@jsonjoy.com/buffers/lib';
 
export class IonDecoder<R extends IReader & IReaderResettable = IReader & IReaderResettable> extends IonDecoderBase<R> {
  public decode(data: Uint8Array): unknown {
    this.reader.reset(data);
 
    // Initialize symbol table with system symbols
    this.symbols = new Import(systemSymbolImport, []);
 
    // Validate Binary Version Marker
    this.validateBVM();
 
    // Read symbol table if present
    this.readSymbolTable();
 
    // Read the main value
    return this.val();
  }
 
  public read(): unknown {
    return this.val();
  }
}