aswi2020vldc-gitlab/templetes/node_modules/hpack.js/tools/utils.js @ 4c84792b
1 |
// Wrap lines after 79 chars
|
---|---|
2 |
exports.wrap = function wrap(str) { |
3 |
var out = []; |
4 |
var pad = ' '; |
5 |
var line = pad; |
6 |
|
7 |
var chunks = str.split(/,/g); |
8 |
chunks.forEach(function(chunk, i) { |
9 |
var append = chunk; |
10 |
if (i !== chunks.length - 1) |
11 |
append += ','; |
12 |
|
13 |
if (line.length + append.length > 79) { |
14 |
out.push(line); |
15 |
line = pad; |
16 |
}
|
17 |
line += append; |
18 |
});
|
19 |
if (line !== pad) |
20 |
out.push(line); |
21 |
|
22 |
return out.join('\n'); |
23 |
};
|
- « Předchozí
- 1
- 2
- 3
- Další »