blob: 2ef31ec84952e8f840abe6919a6da75a62ce4b7e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
interface String {
removeTrailingNewlines(): string;
hasNewline(): boolean;
}
module.exports.AssignStringExtensions = function () {
String.prototype.removeTrailingNewlines = function () {
let sliced = this;
while (sliced.endsWith("\n")) {
sliced = sliced.substring(0, this.length - 1);
}
return sliced as string;
};
String.prototype.hasNewline = function () {
return this.endsWith("\n");
};
};
|