mirror of
https://github.com/TxtDot/dalet.git
synced 2024-11-23 21:36:23 +03:00
fix(ts): main,utils
This commit is contained in:
parent
1626ef38eb
commit
581a7a97cc
3 changed files with 9 additions and 1 deletions
|
@ -11,6 +11,10 @@ export function parseBody(body: Body): CommonBody {
|
|||
return null;
|
||||
}
|
||||
|
||||
if (typeof body === "string") {
|
||||
return body;
|
||||
}
|
||||
|
||||
return body.map((t) => parseTag(t));
|
||||
}
|
||||
|
||||
|
|
|
@ -43,6 +43,6 @@ export abstract class CommonTag {
|
|||
}
|
||||
}
|
||||
|
||||
export type CommonBody = CommonTag[] | null;
|
||||
export type CommonBody = string | CommonTag[] | null;
|
||||
|
||||
export type TagNormalizer = (tag: Tag) => CommonTag;
|
||||
|
|
|
@ -5,6 +5,10 @@ export function bodyToRaw(body: CommonBody): Body {
|
|||
return null;
|
||||
}
|
||||
|
||||
if (typeof body === "string") {
|
||||
return body;
|
||||
}
|
||||
|
||||
return body.map((t) => t.raw);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue