shim.js 414 B

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