UNPKG

raptor-polyfill

Version:

Polyfills for various EcmaScript 5 and EcmaScript 6 methods distributed as CommonJS modules that can be require'd individually or as a whole.

15 lines (12 loc) 364 B
if (!String.prototype.endsWith) { String.prototype.endsWith = function(suffix, position) { var str = this; if (position) { str = str.substring(position); } if (str.length < suffix.length) { return false; } return str.slice(0 - suffix.length) == suffix; }; }