Skip to content

@technobuddha > library > String > Operations

Function: toEnumeration()

ts
function toEnumeration(input: string, ...tests: (
  | string
  | RegExp
  | Iterable<
  | string
  | RegExp, any, any>)[]): undefined | number;

Defined in: to-enumeration.ts:11

Convert a string to a numeric value

Parameters

ParameterTypeDescription
inputstringThe string to convert
...tests( | string | RegExp | Iterable< | string | RegExp, any, any>)[]Array of tests (string value or regular expressions)

Returns

undefined | number

The index of the first test to match the input string