chenyc
2025-05-29 92f69c57b920cf62ecc9f15f9ed196fa26dbf2ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import { round } from '../utils/index';
 
export interface IFaceMatch {
  label: string
  distance: number
}
 
export class FaceMatch implements IFaceMatch {
  private _label: string;
  private _distance: number;
 
  constructor(label: string, distance: number) {
    this._label = label;
    this._distance = distance;
  }
 
  public get label(): string { return this._label; }
 
  public get distance(): number { return this._distance; }
 
  public toString(withDistance = true): string {
    return `${this.label}${withDistance ? ` (${round(this.distance)})` : ''}`;
  }
}