cv-dialog-sdk
Version:
Catavolt Dialog Javascript API
16 lines (12 loc) • 473 B
text/typescript
import { TypeNames } from './types';
export class CodeRef {
constructor(readonly code: string, readonly description: string, readonly type: string = TypeNames.CodeRefTypeName) {}
public toString(): string {
return this.code + ':' + this.description;
}
public static fromString(codeRef): CodeRef {
if(!codeRef) { return null; }
const [code, description] = codeRef.split(':');
return new CodeRef(code, description);
}
}