MCPcopy Create free account
hub / github.com/TruthHun/BookStack / reduceToSingleString

Function reduceToSingleString

static/word2md/mammoth.browser.js:29914–29932  ·  view source on GitHub ↗
(output, base, braces)

Source from the content-addressed store, hash-verified

29912
29913
29914function reduceToSingleString(output, base, braces) {
29915 var numLinesEst = 0;
29916 var length = output.reduce(function(prev, cur) {
29917 numLinesEst++;
29918 if (cur.indexOf('\n') >= 0) numLinesEst++;
29919 return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
29920 }, 0);
29921
29922 if (length > 60) {
29923 return braces[0] +
29924 (base === '' ? '' : base + '\n ') +
29925 ' ' +
29926 output.join(',\n ') +
29927 ' ' +
29928 braces[1];
29929 }
29930
29931 return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
29932}
29933
29934
29935// NOTE: These type checking functions intentionally don't use `instanceof`

Callers 1

formatValueFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected