1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-12-25 01:20:30 +00:00

Fix str.length strEndsWith bug (#2572)

This was some how missed in dev testing I guess. @buggyj suggested this.

Should fix #2571
This commit is contained in:
Devin Weaver 2016-10-08 09:06:30 -04:00 committed by Jeremy Ruston
parent b9299309cc
commit f1090d749e

View File

@ -718,7 +718,7 @@ exports.strEndsWith = function(str,ending,position) {
if (typeof position !== 'number' || !isFinite(position) || Math.floor(position) !== position || position > str.length) { if (typeof position !== 'number' || !isFinite(position) || Math.floor(position) !== position || position > str.length) {
position = str.length; position = str.length;
} }
position -= str.length; position -= ending.length;
var lastIndex = str.indexOf(ending, position); var lastIndex = str.indexOf(ending, position);
return lastIndex !== -1 && lastIndex === position; return lastIndex !== -1 && lastIndex === position;
} }