Skip to content

Commit

Permalink
startsWith polyfill for android 4.4
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyofbyteball committed Jun 19, 2020
1 parent a866fca commit a77a97d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/js/polyfills.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,12 @@ if (typeof Object.assign != 'function') {
return to;
};
}

if (!String.prototype.startsWith) {
Object.defineProperty(String.prototype, 'startsWith', {
value: function(search, rawPos) {
var pos = rawPos > 0 ? rawPos|0 : 0;
return this.substring(pos, pos + search.length) === search;
}
});
}

0 comments on commit a77a97d

Please sign in to comment.