UNPKG

@zeix/ui-element

Version:

UIElement - a HTML-first library for reactive Web Components

32 lines (16 loc) 614 B
[**@zeix/ui-element**](../README.md) *** [@zeix/ui-element](../globals.md) / asEnum # Function: asEnum() > **asEnum**(`valid`): [`Parser`](../type-aliases/Parser.md)\<`string`\> Defined in: [src/lib/parsers.ts:93](https://github.com/zeixcom/ui-element/blob/1e5ebee179adfc4619d3d0e9d2b864d1e97ba797/src/lib/parsers.ts#L93) Parse a string as a multi-state value (for examnple: true, false, mixed), defaulting to the first valid option ## Parameters ### valid \[`string`, `...string[]`\] Array of valid values ## Returns [`Parser`](../type-aliases/Parser.md)\<`string`\> Parser function ## Since 0.9.0