shim.js 442 B

123456789101112131415161718
  1. 'use strict';
  2. var define = require('define-properties');
  3. var getPolyfill = require('./polyfill');
  4. var shimUnscopables = require('es-shim-unscopables');
  5. module.exports = function shimFindLastIndex() {
  6. var polyfill = getPolyfill();
  7. define(
  8. Array.prototype,
  9. { findLastIndex: polyfill },
  10. { findLastIndex: function () { return Array.prototype.findLastIndex !== polyfill; } }
  11. );
  12. shimUnscopables('findLastIndex');
  13. return polyfill;
  14. };