Skip to content
Snippets Groups Projects
Commit 3f584285 authored by marihachi's avatar marihachi
Browse files

toString

parent 5c4c242e
No related branches found
No related tags found
No related merge requests found
......@@ -93,8 +93,15 @@ function nodeStringify(node: MfmNode): string {
throw new Error('unknown mfm node');
}
export function toString(nodes: MfmNode[]): string {
return nodes.map(node => nodeStringify(node)).join('');
export function toString(nodes: MfmNode[]): string
export function toString(node: MfmNode): string
export function toString(node: MfmNode | MfmNode[]): string {
if (Array.isArray(node)) {
return node.map(n => nodeStringify(n)).join('');
}
else {
return nodeStringify(node);
}
}
export {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment