2020-08-20 02:10:42 +02:00
|
|
|
import { isValidNumber } from '../utils';
|
|
|
|
import { Box } from './Box';
|
|
|
|
export class LabeledBox extends Box {
|
2020-08-18 14:04:33 +02:00
|
|
|
constructor(box, label) {
|
|
|
|
super(box);
|
|
|
|
this._label = label;
|
|
|
|
}
|
|
|
|
static assertIsValidLabeledBox(box, callee) {
|
2020-08-20 02:10:42 +02:00
|
|
|
Box.assertIsValidBox(box, callee);
|
|
|
|
if (!isValidNumber(box.label)) {
|
2020-08-18 14:04:33 +02:00
|
|
|
throw new Error(`${callee} - expected property label (${box.label}) to be a number`);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
get label() { return this._label; }
|
|
|
|
}
|
|
|
|
//# sourceMappingURL=LabeledBox.js.map
|