UNPKG

lifecycle-utils

Version:

A set of general utilities for the lifecycle of a JS/TS project/library

11 lines (10 loc) 503 B
/** * 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]"), " !"]` */ export declare function splitText<const S extends string[]>(text: string, separators: S): (string | Separator<S[number]>)[]; export declare class Separator<S extends string> { readonly separator: S; private constructor(); }