Added polyfill for Array.findIndex() if missing

This commit is contained in:
Bryan Roe 2021-08-16 11:59:32 -07:00
parent bf1e30237c
commit b58d7837a3

View File

@ -26,6 +26,27 @@ try
catch(x)
{
}
try
{
Object.defineProperty(Array.prototype, 'findIndex', {
value: function (func)
{
var i = 0;
for (i = 0; i < this.length; ++i)
{
if (func(this[i], i, this))
{
return (i);
}
}
return (-1);
}
});
}
catch (x)
{
}
if (process.platform != 'win32')