Skip to content

hap-fluent / isFluentCharacteristic

Function: isFluentCharacteristic()

ts
function isFluentCharacteristic(value): value is FluentCharacteristic<CharacteristicValue>;

Defined in: packages/hap-fluent/src/type-utils.ts:115

Determine whether value is a FluentCharacteristic instance.

Parameters

ParameterTypeDescription
valueunknownValue to test.

Returns

value is FluentCharacteristic<CharacteristicValue>

true if value has set and get functions (duck-type match).

Remarks

Uses duck-typing to check for set and get methods, matching the FluentCharacteristic public API without requiring an instanceof check.

Example

typescript
if (isFluentCharacteristic(obj)) {
  obj.set(true);
}

Released under the Apache-2.0 License.