All files / src TagDecoder.ts

90% Statements 9/10
75% Branches 3/4
100% Functions 2/2
88.88% Lines 8/9

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 161x 1x   1x   64x 151x 38x     38x   26x      
import {TagClass} from './interfaces/TagClass';
import {TagUniversal} from './interfaces/TagUniversal';
 
export class TagDecoder {
  static getLabel(tagClass: TagClass, tag: number): string {
    if (tagClass === TagClass.UNIVERSAL) {
      const foundTag = Object.values(TagUniversal).find(t => t.code === tag);
      Iif (!foundTag) {
        throw new Error('tag not yet implemented (decimal): ' + tag);
      }
      return foundTag.label;
    }
    return '' + tag;
  }
}