A template of a pathname pattern.

Constructors

  • Creates a new PathnameTemplate instance.

    Parameters

    • pattern: string

      A pathname pattern from which a template is derived.

    • isCaseSensitive: boolean = false

      If true then pathname is matched in a case-sensitive manner.

    Returns PathnameTemplate

Methods

  • Matches a pathname against a pathname pattern.

    Parameters

    • pathname: string

      A pathname to match.

    Returns null | PathnameMatch

    A matching result, or null if pathname doesn't match the template.

  • Creates a pathname (starts with a "/") from a template by substituting params.

    Parameters

    • Optionalparams: void | Dict

      Params to substitute into a template.

    Returns string

    A pathname string.

Properties

isCaseSensitive: boolean

true if pathname is matched in a case-sensitive manner.

paramNames: ReadonlySet<string>

Names of template params.

pattern: string

A pathname pattern from which a template is derived.