add-platform-specific-polyfills.js 915 B

123456789101112131415161718192021222324
  1. "use strict";
  2. exports.__esModule = true;
  3. exports.default = _default;
  4. function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
  5. const webPolyfills = {
  6. "web.timers": {},
  7. "web.immediate": {},
  8. "web.dom.iterable": {}
  9. };
  10. const purePolyfills = {
  11. "es6.parse-float": {},
  12. "es6.parse-int": {},
  13. "es7.string.at": {}
  14. };
  15. function _default(targets, method, polyfills) {
  16. const targetNames = Object.keys(targets);
  17. const isAnyTarget = !targetNames.length;
  18. const isWebTarget = targetNames.some(name => name !== "node");
  19. return _extends({}, polyfills, method === "usage-pure" ? purePolyfills : null, isAnyTarget || isWebTarget ? webPolyfills : null);
  20. }