mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-02 08:50:07 +00:00
types(util): add Split (#834)
This commit is contained in:
@@ -40,6 +40,12 @@ export type StringDigit =
|
||||
| "8"
|
||||
| "9";
|
||||
|
||||
export type Split<S extends string, D extends string> = string extends S
|
||||
? string[]
|
||||
: S extends "" ? []
|
||||
: S extends `${infer T}${D}${infer U}` ? [T, ...Split<U, D>]
|
||||
: [S];
|
||||
|
||||
export type SplitIncludingDelimiters<
|
||||
Source extends string,
|
||||
Delimiter extends string,
|
||||
|
||||
Reference in New Issue
Block a user