MCPcopy Create free account
hub / github.com/RubyLouvre/anu / reduceToSingleString

Function reduceToSingleString

test/babel.js:11006–11019  ·  view source on GitHub ↗
(output, base, braces)

Source from the content-addressed store, hash-verified

11004 }
11005
11006 function reduceToSingleString(output, base, braces) {
11007 var numLinesEst = 0;
11008 var length = output.reduce(function (prev, cur) {
11009 numLinesEst++;
11010 if (cur.indexOf('\n') >= 0) numLinesEst++;
11011 return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
11012 }, 0);
11013
11014 if (length > 60) {
11015 return braces[0] + (base === '' ? '' : base + '\n ') + ' ' + output.join(',\n ') + ' ' + braces[1];
11016 }
11017
11018 return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
11019 }
11020
11021 // NOTE: These type checking functions intentionally don't use `instanceof`
11022 // because it is fragile and can be easily faked with `Object.create()`.

Callers 1

formatValueFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected