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) 371 B
if (!String.prototype.startsWith) { String.prototype.startsWith = function(prefix, position) { var str = this; if (position) { str = str.substring(position); } if (str.length < prefix.length) { return false; } return str.substring(0, prefix.length) == prefix; }; }