mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-04-04 06:53:32 +02:00
Add a cheap Array#includes polyfill.
This commit is contained in:
@@ -62,12 +62,19 @@
|
|||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// < FF43
|
||||||
|
if (!Array.prototype.includes)
|
||||||
|
Array.prototype.includes = function (...args) {
|
||||||
|
return this.indexOf(...args) != -1;
|
||||||
|
};
|
||||||
|
|
||||||
if (!Array.prototype.values)
|
if (!Array.prototype.values)
|
||||||
Array.prototype.values = function* () {
|
Array.prototype.values = function* () {
|
||||||
for (let [i, value] of this.entries())
|
for (let [i, value] of this.entries())
|
||||||
yield value;
|
yield value;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// < FF40
|
||||||
if (!String.prototype.includes)
|
if (!String.prototype.includes)
|
||||||
String.prototype.includes = String.prototype.contains;
|
String.prototype.includes = String.prototype.contains;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user