• Matches a parameter in the form name=Value

    Parameters

    • name: string

      The name of the parameter

    • Optional valueType: string | RegExp

      The type of the value

    • Optional options: {
          global?: boolean;
          optional?: boolean;
      }

      Options for the parameter

      • Optional global?: boolean

        Whether to match globally

      • Optional optional?: boolean

        Whether the parameter is optional

    Returns RegExp

    A RegExp matching a parameter

    Example

    Matching a parameter with a range of possible values

    const m2 = RawParameter("data", /(1|2|a|b)/, { global: false });
    const t2 = "{{placeholder data=1}}";
    const t3 = "{{placeholder data=b}}";
    expect(t2.match(m2)?.[2]).toEqual("1");
    expect(t3.match(m2)?.[2]).toEqual("b");

    See

    QuotedParameter

Generated using TypeDoc