Glob | @uirouter/core
Options
Menu

Class Glob

Matches state names using glob-like pattern strings.

Globs can be used in specific APIs including:

A Glob string is a pattern which matches state names. Nested state names are split into segments (separated by a dot) when processing. The state named foo.bar.baz is split into three segments ['foo', 'bar', 'baz']

Globs work according to the following rules:

Exact match:

The glob 'A.B' matches the state named exactly 'A.B'.

Glob Matches states named Does not match state named
'A' 'A' 'B' , 'A.C'
'A.B' 'A.B' 'A' , 'A.B.C'
'foo' 'foo' 'FOO' , 'foo.bar'

Single star (*)

A single star (*) is a wildcard that matches exactly one segment.

Glob Matches states named Does not match state named
'*' 'A' , 'Z' 'A.B' , 'Z.Y.X'
'A.*' 'A.B' , 'A.C' 'A' , 'A.B.C'
'A.*.*' 'A.B.C' , 'A.X.Y' 'A', 'A.B' , 'Z.Y.X'

Double star (**)

A double star ('**') is a wildcard that matches zero or more segments

Glob Matches states named Does not match state named
'**' 'A' , 'A.B', 'Z.Y.X' (matches all states)
'A.**' 'A' , 'A.B' , 'A.C.X' 'Z.Y.X'
'**.X' 'X' , 'A.X' , 'Z.Y.X' 'A' , 'A.login.Z'
'A.**.X' 'A.X' , 'A.B.X' , 'A.B.C.X' 'A' , 'A.B.C'

Hierarchy

  • Glob

Index

Constructors

Properties

Methods

Constructors

  • new Glob(text: string): Glob

Properties

glob: Array<string>
regexp: RegExp
text: string

Methods

  • matches(name: string): boolean
  • fromString(text: string): Glob
  • Returns a glob from the string, or null if the string isn't Glob-like

  • Returns a glob from the string, or null if the string isn't Glob-like

    Parameters

    • text string

    Returns Glob


  • is(text: string): boolean
  • Returns true if the string has glob-like characters in it

  • Returns true if the string has glob-like characters in it

    Parameters

    • text string

    Returns boolean


Generated using TypeDoc