Add HTML module for rendering messages

This commit is contained in:
Daniel Gasienica 2018-04-10 13:03:05 -04:00
parent 7d4ef9315b
commit 144cb58a47
2 changed files with 108 additions and 0 deletions

12
ts/html/index.ts Normal file
View file

@ -0,0 +1,12 @@
import linkTextInternal from 'link-text';
export const linkText = (value: string): string =>
linkTextInternal(value, { target: '_blank' });
export const replaceLineBreaks = (value: string): string =>
value.replace(/\r?\n/g, '<br>');
// NOTE: How can we use `lodash/fp` `compose` with type checking?
export const render = (value: string): string =>
replaceLineBreaks(linkText(value));