Created
January 18, 2019 17:36
-
-
Save phaberest/85f5a48b731d605f7da2db7b444ae984 to your computer and use it in GitHub Desktop.
Revisions
-
phaberest created this gist
Jan 18, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,28 @@ // includes() polyfill for strings if (!String.prototype.includes) { String.prototype.includes = function(search, start) { 'use strict'; if (typeof start !== 'number') { start = 0; } if (start + search.length > this.length) { return false; } else { return this.indexOf(search, start) !== -1; } }; } // includes() polyfill for arrays if (!Array.prototype.includes) { Object.defineProperty(Array.prototype, "includes", { enumerable: false, value: function(obj) { var newArr = this.filter(function(el) { return el == obj; }); return newArr.length > 0; } }); }