diff --git a/lib/parser/string-methods.js b/lib/parser/string-methods.js index 43eb909..7d51fea 100644 --- a/lib/parser/string-methods.js +++ b/lib/parser/string-methods.js @@ -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) {