MCPcopy Create free account
hub / github.com/binux/qiandao / reduceToSingleString

Function reduceToSingleString

web/static/node_components.js:3269–3287  ·  view source on GitHub ↗
(output, base, braces)

Source from the content-addressed store, hash-verified

3267
3268
3269function reduceToSingleString(output, base, braces) {
3270 var numLinesEst = 0;
3271 var length = output.reduce(function(prev, cur) {
3272 numLinesEst++;
3273 if (cur.indexOf('\n') >= 0) numLinesEst++;
3274 return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
3275 }, 0);
3276
3277 if (length > 60) {
3278 return braces[0] +
3279 (base === '' ? '' : base + '\n ') +
3280 ' ' +
3281 output.join(',\n ') +
3282 ' ' +
3283 braces[1];
3284 }
3285
3286 return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
3287}
3288
3289
3290// NOTE: These type checking functions intentionally don't use `instanceof`

Callers 1

formatValueFunction · 0.85

Calls 1

joinMethod · 0.80

Tested by

no test coverage detected