browser-index.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. "use strict";
  2. // Licensed to the .NET Foundation under one or more agreements.
  3. // The .NET Foundation licenses this file to you under the MIT license.
  4. var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
  5. if (k2 === undefined) k2 = k;
  6. Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
  7. }) : (function(o, m, k, k2) {
  8. if (k2 === undefined) k2 = k;
  9. o[k2] = m[k];
  10. }));
  11. var __exportStar = (this && this.__exportStar) || function(m, exports) {
  12. for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
  13. };
  14. Object.defineProperty(exports, "__esModule", { value: true });
  15. // This is where we add any polyfills we'll need for the browser. It is the entry module for browser-specific builds.
  16. // Copy from Array.prototype into Uint8Array to polyfill on IE. It's OK because the implementations of indexOf and slice use properties
  17. // that exist on Uint8Array with the same name, and JavaScript is magic.
  18. // We make them 'writable' because the Buffer polyfill messes with it as well.
  19. if (!Uint8Array.prototype.indexOf) {
  20. Object.defineProperty(Uint8Array.prototype, "indexOf", {
  21. value: Array.prototype.indexOf,
  22. writable: true,
  23. });
  24. }
  25. if (!Uint8Array.prototype.slice) {
  26. Object.defineProperty(Uint8Array.prototype, "slice", {
  27. // wrap the slice in Uint8Array so it looks like a Uint8Array.slice call
  28. // eslint-disable-next-line object-shorthand
  29. value: function (start, end) { return new Uint8Array(Array.prototype.slice.call(this, start, end)); },
  30. writable: true,
  31. });
  32. }
  33. if (!Uint8Array.prototype.forEach) {
  34. Object.defineProperty(Uint8Array.prototype, "forEach", {
  35. value: Array.prototype.forEach,
  36. writable: true,
  37. });
  38. }
  39. __exportStar(require("./index"), exports);
  40. //# sourceMappingURL=browser-index.js.map