Added some tests
This commit is contained in:
22
tests/node_modules/tap-spec/lib/utils/l-trim-list.js
generated
vendored
Normal file
22
tests/node_modules/tap-spec/lib/utils/l-trim-list.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
var _ = require('lodash');
|
||||
|
||||
module.exports = function (lines) {
|
||||
|
||||
var leftPadding;
|
||||
|
||||
// Get minimum padding count
|
||||
_.each(lines, function (line) {
|
||||
|
||||
var spaceLen = line.match(/^\s+/)[0].length;
|
||||
|
||||
if (leftPadding === undefined || spaceLen < leftPadding) {
|
||||
leftPadding = spaceLen;
|
||||
}
|
||||
});
|
||||
|
||||
// Strip padding at beginning of line
|
||||
return _.map(lines, function (line) {
|
||||
|
||||
return line.slice(leftPadding);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user