import {Device} from '@/Device' export class ComponentBase { // static SCHEMA = {} id?: string name = '' measurementName = '' device: Device | null = null private _schema: {[key: string]: string} | null = null // static __schema: {[key: string]: string} = {} // constructor() { // // init properties to null // Object.keys(this.getSchema()).forEach(prop => this[prop] = null) // } getSchema(): Record { if (this._schema == null) { this._schema = {} for (const [key, value] of Object.entries(this)) { if (key == "_schema") continue this._schema[key] = typeof value delete this[key] } } return this._schema } } export function Bool(value: string): boolean { if (typeof value != 'string') value = String(value) // console.log("Bool", value) value = value.toUpperCase() return value == "ON" || value == "1" || value == "TRUE" || value == "YES" }