Skip to content

Commit

Permalink
Fixed String.endsWith comparisons
Browse files Browse the repository at this point in the history
  • Loading branch information
dengjeffrey committed Jan 7, 2019
1 parent a756f47 commit 9cff87f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/parser/string-methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ module.exports = {
throw new Error(`${substr} is not a string.`);
}

return str.indexOf(substr) + substr.length === str.length;
const strSuffix = str.substring(str.length - substr.length, str.length)
return strSuffix === substr
},

replace(str, substr, replacement) {
Expand Down

0 comments on commit 9cff87f

Please sign in to comment.