@zeix/ui-element
Version:
UIElement - a HTML-first library for reactive Web Components
32 lines (16 loc) • 654 B
Markdown
[**@zeix/ui-element**](../README.md)
***
[@zeix/ui-element](../globals.md) / asEnum
# Function: asEnum()
> **asEnum**(`valid`): [`AttributeParser`](../type-aliases/AttributeParser.md)\<`string`\>
Defined in: [src/lib/parsers.ts:83](https://github.com/zeixcom/ui-element/blob/297c0e8e040b3880ad85a2bc873523a8086f09a3/src/lib/parsers.ts#L83)
Parse an attribute 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
[`AttributeParser`](../type-aliases/AttributeParser.md)\<`string`\>
parser function
## Since
0.9.0