mirror of
https://github.com/TxtDot/dalet.git
synced 2024-11-21 12:26: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;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (typeof body === "string") {
|
||||||
|
return body;
|
||||||
|
}
|
||||||
|
|
||||||
return body.map((t) => parseTag(t));
|
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;
|
export type TagNormalizer = (tag: Tag) => CommonTag;
|
||||||
|
|
|
@ -5,6 +5,10 @@ export function bodyToRaw(body: CommonBody): Body {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (typeof body === "string") {
|
||||||
|
return body;
|
||||||
|
}
|
||||||
|
|
||||||
return body.map((t) => t.raw);
|
return body.map((t) => t.raw);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue