Skip to content

Commit

Permalink
🔒 fix: CVE-2023-26115
Browse files Browse the repository at this point in the history
  • Loading branch information
aashutoshrathi committed Mar 25, 2023
1 parent 786ebf1 commit 235cfd4
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
/*!
* word-wrap <https://github.com/jonschlinkert/word-wrap>
*
* Copyright (c) 2014-2017, Jon Schlinkert.
* Copyright (c) 2014-2023, Jon Schlinkert.
* 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 @@ -36,7 +42,7 @@ module.exports = function(str, options) {
}).join(newline);

if (options.trim === true) {
result = result.replace(/[ \t]*$/gm, '');
result = trimTabAndSpaces(result);
}
return result;
};
Expand Down

0 comments on commit 235cfd4

Please sign in to comment.