hap-fluent / isCharacteristicValue
Function: isCharacteristicValue()
ts
function isCharacteristicValue(value): value is CharacteristicValue;Defined in: packages/hap-fluent/src/type-guards.ts:36
Determine whether value is a valid HAP CharacteristicValue.
Parameters
| Parameter | Type | Description |
|---|---|---|
value | unknown | Value to test. |
Returns
value is CharacteristicValue
true if value is a string, number, boolean, or non-null object.
Remarks
The HAP specification defines valid characteristic value types as: string, number, boolean, or object. null and undefined are not valid — hap-nodejs will throw if you attempt to set them.
Example
typescript
isCharacteristicValue(true); // true
isCharacteristicValue(75); // true
isCharacteristicValue(null); // false
isCharacteristicValue(undefined); // false