UNPKG

array.prototype.findlastindex

Version:

An ESnext spec-compliant `Array.prototype.findLastIndex` shim/polyfill/replacement that works as far down as ES3.

19 lines (14 loc) 442 B
'use strict'; var define = require('define-properties'); var getPolyfill = require('./polyfill'); var shimUnscopables = require('es-shim-unscopables'); module.exports = function shimFindLastIndex() { var polyfill = getPolyfill(); define( Array.prototype, { findLastIndex: polyfill }, { findLastIndex: function () { return Array.prototype.findLastIndex !== polyfill; } } ); shimUnscopables('findLastIndex'); return polyfill; };