• Find the indices of characters in a source text.

    Parameters

    • source: string

      The source text which should be searched.

    • query: string

      The characters to locate in the source text.

    • start: number = 0

      The index to start the search.

    Returns number[] | null

    The matched indices, or null if there is no match.

    Complexity

    Linear on sourceText.

    Notes

    In order for there to be a match, all of the characters in query must appear in source in the order given by query.

    Characters are matched using strict === equality.