1import { Vector } from '../types/vector';
2import { DisplayProcessor } from '../types';
3import { formattedValueToString } from '../valueFormats';
4import { FunctionalVector } from './FunctionalVector';
5
6/**
7 * @public
8 */
9export class FormattedVector<T = any> extends FunctionalVector<string> {
10  constructor(private source: Vector<T>, private formatter: DisplayProcessor) {
11    super();
12  }
13
14  get length() {
15    return this.source.length;
16  }
17
18  get(index: number): string {
19    const v = this.source.get(index);
20    return formattedValueToString(this.formatter(v));
21  }
22}
23