import { deepFreeze } from "../../utils"; export class Core { constructor({ supportsBattery = false, supportsManufacturerData = false, gattServices, gattCharacteristics, manufacturer, model, firmwareVersion, serial, reconnectOnDisconnect = true, requiresPairing = false, } = {}) { this.supportsBattery = Boolean(supportsBattery); this.supportsManufacturerData = Boolean(supportsManufacturerData); this.gattServices = Array.isArray(gattServices) ? gattServices.slice() : undefined; this.gattCharacteristics = gattCharacteristics && typeof gattCharacteristics === "object" ? Object.assign({}, gattCharacteristics) : undefined; this.manufacturer = manufacturer; this.model = model; this.firmwareVersion = firmwareVersion; this.serial = serial; this.reconnectOnDisconnect = Boolean(reconnectOnDisconnect); this.requiresPairing = Boolean(requiresPairing); deepFreeze(this); } merge = (partial) => new Core(Object.assign({}, this, partial)); }