Add HTML
module for rendering messages
This commit is contained in:
parent
7d4ef9315b
commit
144cb58a47
2 changed files with 108 additions and 0 deletions
12
ts/html/index.ts
Normal file
12
ts/html/index.ts
Normal 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));
|
Loading…
Add table
Add a link
Reference in a new issue