Skip to content

Commit

Permalink
fix: settle for new regex to support lower node versions
Browse files Browse the repository at this point in the history
  • Loading branch information
aashutoshrathi committed Jun 9, 2023
1 parent 235cfd4 commit d6e8514
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@
* Released under the MIT License.
*/

function trimTabAndSpaces(str) {
const lines = str.split('\n');
const trimmedLines = lines.map((line) => line.trimEnd());
return trimmedLines.join('\n');
}

module.exports = function(str, options) {
options = options || {};
if (str == null) {
Expand Down Expand Up @@ -42,7 +36,7 @@ module.exports = function(str, options) {
}).join(newline);

if (options.trim === true) {
result = trimTabAndSpaces(result);
result = result.replace(/\s+$/g, '');
}
return result;
};
Expand Down

0 comments on commit d6e8514

Please sign in to comment.