Skip to content

Commit d6e8514

Browse files
fix: settle for new regex to support lower node versions
1 parent 235cfd4 commit d6e8514

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

index.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@
55
* Released under the MIT License.
66
*/
77

8-
function trimTabAndSpaces(str) {
9-
const lines = str.split('\n');
10-
const trimmedLines = lines.map((line) => line.trimEnd());
11-
return trimmedLines.join('\n');
12-
}
13-
148
module.exports = function(str, options) {
159
options = options || {};
1610
if (str == null) {
@@ -42,7 +36,7 @@ module.exports = function(str, options) {
4236
}).join(newline);
4337

4438
if (options.trim === true) {
45-
result = trimTabAndSpaces(result);
39+
result = result.replace(/\s+$/g, '');
4640
}
4741
return result;
4842
};

0 commit comments

Comments
 (0)