api-builder: trim blank lines from the end of a text block too
This commit is contained in:
parent
096e5f081b
commit
93c187de2a
|
@ -6,6 +6,9 @@ module.exports = function() {
|
|||
while(lines.length && (lines[0].trim() === '')) {
|
||||
lines.shift();
|
||||
}
|
||||
while(lines.length && (lines[lines.length-1].trim() === '')) {
|
||||
lines.pop();
|
||||
}
|
||||
return lines.join('\n');
|
||||
}
|
||||
};
|
||||
|
|
|
@ -11,8 +11,8 @@ describe('trimBlankLines filter', function() {
|
|||
expect(filter.name).toEqual('trimBlankLines');
|
||||
});
|
||||
|
||||
it('should remove all empty lines from the start of the string', function() {
|
||||
it('should remove empty lines from the start and end of the string', function() {
|
||||
expect(filter.process('\n \n\nsome text\n \nmore text\n \n'))
|
||||
.toEqual('some text\n\nmore text\n\n');
|
||||
.toEqual('some text\n \nmore text');
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue