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:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user