Skip to content

@clerc/advanced-types

Classes

ClassDescription

FlagValidationError

Functions

FunctionDescription

Enum

Creates a Enum type function that validates the input against allowed values. The display name will be formatted as "value1 | value2 | ..." for help output.

Example

typescript
const 
format
= Enum(["json", "yaml", "xml"]);
// Help output will show: json | yaml | xml

Throws

If the value is not in the allowed values list

Range

Creates a range type function that validates the input is a number within the specified range.

Throws

If the value is not a number or is outside the specified range

Regex

Creates a regex type function that validates the input against the provided pattern.

Throws

If the value does not match the regex pattern

Released under the MIT license