Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Conditions

Convert range of arguments into a collection of regular expressions. Config changes flags and filtering. Multiple conditions can be combined.

Hierarchy

  • Conditions

Index

Constructors

constructor

  • Created new conditions instance. Generate expressions from conditions and options. Created new conditions instance. Generate expressions from conditions and options.

    Parameters

    Returns Conditions

Properties

captured

  • get captured(): undefined | string | object

captures

captures: object

Type declaration

  • [key: number]: string | undefined

config

config: IOptions

expressions

expressions: object

Type declaration

  • [key: string]: RegExp

match

  • get match(): undefined | false | true | RegExpMatchArray
  • Get success of all matches or the first match object if only one

    Returns undefined | false | true | RegExpMatchArray

matched

  • get matched(): undefined | RegExpMatchArray | object
  • Get the result of all matches or the first if only one and no keys used

    Returns undefined | RegExpMatchArray | object

matches

matches: object

Type declaration

  • [key: number]: RegExpMatchArray | undefined

success

  • get success(): boolean

Methods

add

  • add(condition: string | RegExp | Condition, key?: string | number): this
  • Add new condition, converted to regular expression. Assigns to either an integer index (as string), or a given key. Returns self for chaining multiple additions.

    Parameters

    • condition: string | RegExp | Condition
    • Optional key: string | number

    Returns this

clear

  • clear(): void
  • Clear results but keep expressions and config.

    Returns void

clearAll

  • clearAll(): void
  • Clear expressions too, just keep config.

    Returns void

exec

  • exec(str: string): object
  • Test a string against all expressions.

    Parameters

    • str: string

    Returns object

    • [key: number]: RegExpMatchArray | undefined

Generated using TypeDoc