@meyer/hyperdeck-emulator
Version:
Typescript Node.js library for emulating a Blackmagic Hyperdeck
19 lines (15 loc) • 442 B
text/typescript
import util from 'util';
export class FormattedError extends Error {
constructor(template: string, ...args: any[]) {
super(util.format(template, ...args));
this.template = template;
this.args = args;
}
public template: string;
public args: any[];
}
export function invariant(condition: any, message: string, ...args: any[]): asserts condition {
if (!condition) {
throw new FormattedError(message, ...args);
}
}