Buggy `String#endsWith` with `position` argument #168

Closed
mathiasbynens opened this Issue Dec 17, 2013 · 0 comments

Comments

Projects
None yet
1 participant
Contributor

mathiasbynens commented Dec 17, 2013

This implementation fails the following tests taken from https://github.com/mathiasbynens/String.prototype.endsWith/blob/master/tests/tests.js:

assertEquals('abc'.endsWith('b', -1), false);
assertEquals('abc'.endsWith('ab', -1), false);

There’s also this issue:

assertThrows(function() { '[a-z]+(bar)?'.endsWith(/(bar)?/); }, TypeError);
assertThrows(function() { '[a-z]+(bar)?'.endsWith(/(bar)?/); }, TypeError);
assertThrows(function() { '[a-z]+/(bar)?/'.endsWith(/(bar)?/); }, TypeError);

…but that’s covered in #167.

paulmillr closed this in #171 Dec 18, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment