hap-fluent / isService
Function: isService()
ts
function isService(obj): obj is Service;Defined in: packages/hap-fluent/src/type-guards.ts:60
Determine whether obj is a valid hap-nodejs Service instance.
Parameters
| Parameter | Type | Description |
|---|---|---|
obj | unknown | Value to test. |
Returns
obj is Service
true if obj satisfies the minimal Service interface.
Remarks
Validates structural requirements: UUID (string), displayName (string), getCharacteristic (function), and addCharacteristic (function). This duck-type check is sufficient for hap-fluent's use — it avoids an instanceof check that would fail across different hap-nodejs module instances (common in monorepo setups where multiple packages resolve hap-nodejs independently).