DenReg/jsx-html/node/TextNode.ts

13 lines
283 B
TypeScript
Raw Normal View History

2020-10-14 00:56:11 +00:00
import { NODE_TYPE } from '../constants.ts';
import { htmlEncode } from './utils/htmlEncode.ts';
export class TextNode {
type = NODE_TYPE.TEXT;
constructor(public text: string) {}
async render(): Promise<string | any[]> {
return htmlEncode(this.text);
}
}