aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/helpers/utils/html.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/helpers/utils/html.ts')
-rw-r--r--client/src/app/helpers/utils/html.ts18
1 files changed, 18 insertions, 0 deletions
diff --git a/client/src/app/helpers/utils/html.ts b/client/src/app/helpers/utils/html.ts
new file mode 100644
index 000000000..2d520aee9
--- /dev/null
+++ b/client/src/app/helpers/utils/html.ts
@@ -0,0 +1,18 @@
1import { immutableAssign } from './object'
2
3function objectLineFeedToHtml (obj: any, keyToNormalize: string) {
4 return immutableAssign(obj, {
5 [keyToNormalize]: lineFeedToHtml(obj[keyToNormalize])
6 })
7}
8
9function lineFeedToHtml (text: string) {
10 if (!text) return text
11
12 return text.replace(/\r?\n|\r/g, '<br />')
13}
14
15export {
16 objectLineFeedToHtml,
17 lineFeedToHtml
18}