predictype

predictype v0.8.1


predictype / predicates/booleans/booleanState / booleanState

Function: booleanState()

booleanState(source, oper): boolean

Defined in: predicates/booleans/booleanState.ts:24

Checks the state of a boolean value (true or false) using the specified operation.

Parameters

source

boolean

The boolean value to check.

oper

BooleanStateOper

The operation to perform (e.g. ‘is_true’, ‘is_false’).

Returns

boolean

True if the state check is valid according to the operator, otherwise false.

Throws

If the operation is not recognized.

Example

const valueTrue = true;
const valueFalse = false;

booleanState(valueTrue, 'is_true'); // true
booleanState(valueFalse, 'is_false'); // true

Remarks

Supported Operators: