From 5214cdfbf26bc0bdee5d669a237fb8aefffb78d5 Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Wed, 30 Aug 2023 21:35:28 +0200 Subject: story! --- resources/js/helpers.js | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'resources/js/helpers.js') diff --git a/resources/js/helpers.js b/resources/js/helpers.js index 58e2113..bceaf5e 100644 --- a/resources/js/helpers.js +++ b/resources/js/helpers.js @@ -13,6 +13,15 @@ function slugToName (slug) { .split('-').map((item) => ucfirst(item)).join(' '); } +/** + * @param {string} text + * + * @returns {string} + */ +function nl2br (text) { + return text.replace(new RegExp(/\\n/g), '
'); +} + /** * @param {string} color * -- cgit v1.2.3