1 | /**
|
2 | * Matches state names using glob-like pattern strings.
|
3 | *
|
4 | * Globs can be used in specific APIs including:
|
5 | *
|
6 | * - [[StateService.is]]
|
7 | * - [[StateService.includes]]
|
8 | * - The first argument to Hook Registration functions like [[TransitionService.onStart]]
|
9 | * - [[HookMatchCriteria]] and [[HookMatchCriterion]]
|
10 | *
|
11 | * A `Glob` string is a pattern which matches state names.
|
12 | * Nested state names are split into segments (separated by a dot) when processing.
|
13 | * The state named `foo.bar.baz` is split into three segments ['foo', 'bar', 'baz']
|
14 | *
|
15 | * Globs work according to the following rules:
|
16 | *
|
17 | * ### Exact match:
|
18 | *
|
19 | * The glob `'A.B'` matches the state named exactly `'A.B'`.
|
20 | *
|
21 | * | Glob |Matches states named|Does not match state named|
|
22 | * |:------------|:--------------------|:---------------------|
|
23 | * | `'A'` | `'A'` | `'B'` , `'A.C'` |
|
24 | * | `'A.B'` | `'A.B'` | `'A'` , `'A.B.C'` |
|
25 | * | `'foo'` | `'foo'` | `'FOO'` , `'foo.bar'`|
|
26 | *
|
27 | * ### Single star (`*`)
|
28 | *
|
29 | * A single star (`*`) is a wildcard that matches exactly one segment.
|
30 | *
|
31 | * | Glob |Matches states named |Does not match state named |
|
32 | * |:------------|:---------------------|:--------------------------|
|
33 | * | `'*'` | `'A'` , `'Z'` | `'A.B'` , `'Z.Y.X'` |
|
34 | * | `'A.*'` | `'A.B'` , `'A.C'` | `'A'` , `'A.B.C'` |
|
35 | * | `'A.*.*'` | `'A.B.C'` , `'A.X.Y'`| `'A'`, `'A.B'` , `'Z.Y.X'`|
|
36 | *
|
37 | * ### Double star (`**`)
|
38 | *
|
39 | * A double star (`'**'`) is a wildcard that matches *zero or more segments*
|
40 | *
|
41 | * | Glob |Matches states named |Does not match state named |
|
42 | * |:------------|:----------------------------------------------|:----------------------------------|
|
43 | * | `'**'` | `'A'` , `'A.B'`, `'Z.Y.X'` | (matches all states) |
|
44 | * | `'A.**'` | `'A'` , `'A.B'` , `'A.C.X'` | `'Z.Y.X'` |
|
45 | * | `'**.X'` | `'X'` , `'A.X'` , `'Z.Y.X'` | `'A'` , `'A.login.Z'` |
|
46 | * | `'A.**.X'` | `'A.X'` , `'A.B.X'` , `'A.B.C.X'` | `'A'` , `'A.B.C'` |
|
47 | *
|
48 | * @packageDocumentation
|
49 | */
|
50 | export declare class Glob {
|
51 | text: string;
|
52 | glob: Array<string>;
|
53 | regexp: RegExp;
|
54 | /** Returns true if the string has glob-like characters in it */
|
55 | static is(text: string): boolean;
|
56 | /** Returns a glob from the string, or null if the string isn't Glob-like */
|
57 | static fromString(text: string): Glob;
|
58 | constructor(text: string);
|
59 | matches(name: string): boolean;
|
60 | }
|