#2496 Unbreaking state diagrams

This commit is contained in:
Knut Sveidqvist
2021-11-17 22:30:30 +01:00
parent 3feff08d42
commit 72d2045104
3 changed files with 20 additions and 11 deletions

View File

@@ -80,6 +80,13 @@ export const sanitizeText = (text, config) => {
return txt;
};
export const sanitizeTextOrArray = (a, config) => {
if (typeof a === 'string') return sanitizeText(a, config);
const f = (x) => sanitizeText(x, config);
return a.flat().map(f);
};
export const lineBreakRegex = /<br\s*\/?>/gi;
/**
@@ -149,6 +156,7 @@ export const evaluate = (val) => (val === 'false' || val === false ? false : tru
export default {
getRows,
sanitizeText,
sanitizeTextOrArray,
hasBreaks,
splitBreaks,
lineBreakRegex,