3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-10 04:25:01 +00:00

feat: limit logs timestamp_format length

This commit is contained in:
Dragory 2023-11-25 12:28:28 +02:00
parent c82e147ea1
commit fafaefa1fb
No known key found for this signature in database
3 changed files with 23 additions and 4 deletions

View file

@ -0,0 +1,17 @@
import * as t from "io-ts";
interface BoundedStringBrand {
readonly BoundedString: unique symbol;
}
export function asBoundedString(str: string) {
return str as t.Branded<string, BoundedStringBrand>;
}
export function tBoundedString(min: number, max: number) {
return t.brand(
t.string,
(str): str is t.Branded<string, BoundedStringBrand> => (str.length >= min && str.length <= max),
"BoundedString",
);
}