UNPKG

homebridge-virtual-accessories

Version:
29 lines 935 B
/* eslint-disable curly */ import { SensorType, TriggerType } from './schema.js'; import { Utils } from '../utils/utils.js'; /** * */ export class SensorConfiguration { type; trigger; errorFields = []; fieldNames = Utils.proxiedPropertiesOf(this); isValid(prefix) { const isValidType = (Utils.required(this.type) && SensorType.Types.includes(this.type)); const isValidTrigger = (Utils.required(this.trigger) && TriggerType.Types.includes(this.trigger)); // Store fields failing validation if (!isValidType) this.errorFields.push(prefix + '.' + this.fieldNames.type); if (!isValidTrigger) this.errorFields.push(prefix + '.' + this.fieldNames.trigger); return [ (isValidType && isValidTrigger), this.errorFields, ]; } } //# sourceMappingURL=configurationSensor.js.map