@elemental/common / Function

booleanOrStringAttribute

This function checks the type of the input value and returns a boolean or string based on the input. If the input value is a boolean, it returns the value as is. If the input value is a string and not one of 'false', 'true', or an empty string, it returns the value as is. If the input value is null or 'false', it returns false. Otherwise, it returns true.

Presentation

function booleanOrStringAttribute(value: unknown): string | boolean;

Returns

string | boolean -

{boolean | string} - The output value based on the input.

Parameters

NameTypeDescription
value
unknown

@param {unknown} value - The input value to be checked.