MCPcopy
hub / github.com/Exrick/xpay / blockHeader

Function blockHeader

xpay-code/src/main/resources/static/swagger/swagger-ui.js:10586–10595  ·  view source on GitHub ↗
(string, indentPerLevel)

Source from the content-addressed store, hash-verified

10584
10585// Pre-conditions: string is valid for a block scalar, 1 <= indentPerLevel <= 9.
10586function blockHeader(string, indentPerLevel) {
10587 var indentIndicator = (string[0] === ' ') ? String(indentPerLevel) : '';
10588
10589 // note the special case: the string '\n' counts as a "trailing" empty line.
10590 var clip = string[string.length - 1] === '\n';
10591 var keep = clip && (string[string.length - 2] === '\n' || string === '\n');
10592 var chomp = keep ? '+' : (clip ? '' : '-');
10593
10594 return indentIndicator + chomp + '\n';
10595}
10596
10597// (See the note for writeScalar.)
10598function dropEndingNewline(string) {

Callers 1

writeScalarFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected