add util.trimRight method - fixes #147
This commit is contained in:
parent
ae439d27b9
commit
896929378e
@ -11,7 +11,7 @@ function Buffer(position, format) {
|
||||
}
|
||||
|
||||
Buffer.prototype.get = function () {
|
||||
return this.buf.trimRight();
|
||||
return util.trimRight(this.buf);
|
||||
};
|
||||
|
||||
Buffer.prototype.getIndent = function () {
|
||||
@ -116,7 +116,7 @@ Buffer.prototype.endsWith = function (str) {
|
||||
|
||||
Buffer.prototype.isLast = function (cha, trimRight) {
|
||||
var buf = this.buf;
|
||||
if (trimRight) buf = buf.trimRight();
|
||||
if (trimRight) buf = util.trimRight(buf);
|
||||
|
||||
var chars = [].concat(cha);
|
||||
return _.contains(chars, _.last(buf));
|
||||
|
||||
@ -25,6 +25,10 @@ exports.resolve = function (loc) {
|
||||
}
|
||||
};
|
||||
|
||||
exports.trimRight = function (str) {
|
||||
return str.replace(/[\n\s]+$/g, "");
|
||||
};
|
||||
|
||||
exports.list = function (val) {
|
||||
return val ? val.split(",") : [];
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user