Skip to main content

@rtorcato/js-common / boolean

boolean

Functions

toBoolean()

toBoolean(value): boolean

Defined in: boolean/index.ts:8

Converts a value to a boolean. Accepts 'true', '1', 1 as true; 'false', '0', 0 as false.

Parameters

value

unknown

The value to convert.

Returns

boolean

The boolean representation.


isBoolean()

isBoolean(value): value is boolean

Defined in: boolean/index.ts:27

Checks if a value is a boolean.

Parameters

value

unknown

The value to check.

Returns

value is boolean

True if the value is a boolean, false otherwise.


xor()

xor(a, b): boolean

Defined in: boolean/index.ts:37

Returns the logical exclusive OR (XOR) of two booleans.

Parameters

a

boolean

First boolean.

b

boolean

Second boolean.

Returns

boolean

True if exactly one of a or b is true.


and()

and(a, b): boolean

Defined in: boolean/index.ts:47

Logical AND for two booleans.

Parameters

a

boolean

First boolean.

b

boolean

Second boolean.

Returns

boolean

True if both a and b are true.


or()

or(a, b): boolean

Defined in: boolean/index.ts:57

Logical OR for two booleans.

Parameters

a

boolean

First boolean.

b

boolean

Second boolean.

Returns

boolean

True if either a or b is true.


not()

not(a): boolean

Defined in: boolean/index.ts:66

Logical NOT for a boolean.

Parameters

a

boolean

The boolean to negate.

Returns

boolean

The negated boolean.