lifecycle-utils
    Preparing search index...

    Function splitText

    • Split a text by multiple separators, and return a result of the text and separators. For example, splitText("Hello <and> world [then] !", ["<and>", "[then]"]) will return ["Hello ", new Separator("<and>"), " world ", new Separator("[then]"), " !"]

      Type Parameters

      • const S extends string

      Parameters

      • text: string
      • separators: readonly S[]

      Returns (string | { [Sep in string]: Separator<Sep> }[S])[]