1 | if (!String.prototype.endsWith) {
|
2 | String.prototype.endsWith = function(searchString, position) {
|
3 | var subjectString = this.toString();
|
4 | if (position === undefined || position > subjectString.length) {
|
5 | position = subjectString.length;
|
6 | }
|
7 | position -= searchString.length;
|
8 | var lastIndex = subjectString.indexOf(searchString, position);
|
9 | return lastIndex !== -1 && lastIndex === position;
|
10 | };
|
11 | } |
\ | No newline at end of file |