Skip to content

Commit

Permalink
forces convertion to string inside trim function
Browse files Browse the repository at this point in the history
  • Loading branch information
cnavarreteliz authored and davelandry committed Jul 30, 2019
1 parent 94f73d7 commit 1a8b1bc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/trim.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
@param {String} str
*/
function trim(str) {
return str.replace(/^\s+|\s+$/g, "");
return str.toString().replace(/^\s+|\s+$/g, "");
}

/**
Expand All @@ -13,7 +13,7 @@ function trim(str) {
@param {String} str
*/
function trimLeft(str) {
return str.replace(/^\s+/, "");
return str.toString().replace(/^\s+/, "");
}

/**
Expand All @@ -22,7 +22,7 @@ function trimLeft(str) {
@param {String} str
*/
function trimRight(str) {
return str.replace(/\s+$/, "");
return str.toString().replace(/\s+$/, "");
}

export {trim, trimLeft, trimRight};

0 comments on commit 1a8b1bc

Please sign in to comment.