1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-04 11:54:11 +01:00

Add a cheap Array#includes polyfill.

This commit is contained in:
Doug Kearns
2015-12-21 23:57:09 +11:00
parent 40e757aec9
commit 42ac708456

View File

@@ -62,12 +62,19 @@
return result;
};
// < FF43
if (!Array.prototype.includes)
Array.prototype.includes = function (...args) {
return this.indexOf(...args) != -1;
};
if (!Array.prototype.values)
Array.prototype.values = function* () {
for (let [i, value] of this.entries())
yield value;
};
// < FF40
if (!String.prototype.includes)
String.prototype.includes = String.prototype.contains;