1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
import { immutableAssign } from './object' function objectLineFeedToHtml (obj: any, keyToNormalize: string) { return immutableAssign(obj, { [keyToNormalize]: lineFeedToHtml(obj[keyToNormalize]) }) } function lineFeedToHtml (text: string) { if (!text) return text return text.replace(/\r?\n|\r/g, '<br />') } export { objectLineFeedToHtml, lineFeedToHtml }