azproduction / grunt-autopolyfiller

Grunt plugin for autopolyfiller
25 stars 1 forks source link

String.prototype.endsWith #8

Open cavez86 opened 8 years ago

cavez86 commented 8 years ago

Using options: { include: ['String.prototype.endsWith'] }

the task generates this code: if (!String.prototype.endsWith) { // String.prototype.endsWith String.prototype.endsWith = function (string) { var index = arguments.length < 2 ? this.length : arguments[1];

return this.**indexOf**(string) === index - string.length;

}; }

that is wrong!

It shoud be: if (!String.prototype.endsWith) { // String.prototype.endsWith String.prototype.endsWith = function (string) { var index = arguments.length < 2 ? this.length : arguments[1];

return this.**lastIndexOf**(string) === index - string.length;

}; }