Skip to content

hap-fluent / ValueTransformer

Type Alias: ValueTransformer<TInput, TOutput>

ts
type ValueTransformer<TInput, TOutput> = (value) => TOutput;

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

A function that transforms a characteristic value from one type/shape to another.

Type Parameters

Type ParameterDefault typeDescription
TInputCharacteristicValueInput value type.
TOutputCharacteristicValueOutput value type.

Parameters

ParameterType
valueTInput

Returns

TOutput

Example

typescript
const percentToDecimal: ValueTransformer<number, number> = (value) => value / 100;

Released under the Apache-2.0 License.