• Matches a list of values of a specific type

    Parameters

    • valueType: string | RegExp | (string | RegExp)[]

      The type(s) of values to match in the list

    • Optional options: {
          global?: boolean;
          separator?: string;
      }

      Options for the list

      • Optional global?: boolean

        Whether to match globally

      • Optional separator?: string

        The separator between values in the list

    Returns RegExp

    A RegExp matching a list of values

    Example

    Matching a list of integers

    const m1 = List(Integer());
    const t1 = "{{list:1,2,3}}";
    expect(t1.match(m1)).toEqual(["1", "2", "3"]);

    Example

    Matching a mixed list

    const m1 = List([Bool(), Integer(), HTTPURL()]);
    const t1 = "{{list:1,https://www.google.com,true}}";
    expect(t1.match(m1)).toEqual(["1", "https://www.google.com", "true"]);

Generated using TypeDoc