shim.js 399 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 shimFlat() {
  6. var polyfill = getPolyfill();
  7. define(
  8. Array.prototype,
  9. { flat: polyfill },
  10. { flat: function () { return Array.prototype.flat !== polyfill; } }
  11. );
  12. shimUnscopables('flat');
  13. return polyfill;
  14. };