String.includes.js 341 B

1234567891011121314
  1. if (!String.prototype.includes) {
  2. // eslint-disable-next-line no-extend-native
  3. String.prototype.includes = function (search, start) {
  4. if (typeof start !== "number") {
  5. start = 0;
  6. }
  7. if (start + search.length > this.length) {
  8. return false;
  9. } else {
  10. return this.indexOf(search, start) !== -1;
  11. }
  12. };
  13. }