polyfill.ts 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695
  1. /**
  2. * Copyright (c) 2020 mol* contributors, licensed under MIT, See LICENSE file for more info.
  3. *
  4. * @author Alexander Rose <alexander.rose@weirdbyte.de>
  5. */
  6. if (typeof window !== 'undefined') {
  7. (function () {
  8. // Console-polyfill. MIT license.
  9. // https://github.com/paulmillr/console-polyfill
  10. // Make it safe to do console.log() always.
  11. (window as any).console = window.console || {};
  12. let con = window.console;
  13. let prop, method;
  14. let empty = {};
  15. let dummy = function () {};
  16. let properties = 'memory'.split(',');
  17. let methods = (
  18. 'assert,clear,count,debug,dir,dirxml,error,exception,group,' +
  19. 'groupCollapsed,groupEnd,info,log,markTimeline,profile,profiles,profileEnd,' +
  20. 'show,table,time,timeEnd,timeline,timelineEnd,timeStamp,trace,warn'
  21. ).split(',');
  22. while ((prop = properties.pop())) if (!(con as any)[prop]) (con as any)[prop] = empty;
  23. while ((method = methods.pop())) if (!(con as any)[method]) (con as any)[method] = dummy;
  24. })();
  25. }
  26. if (typeof window.HTMLCanvasElement !== 'undefined' && !window.HTMLCanvasElement.prototype.toBlob) {
  27. // http://code.google.com/p/chromium/issues/detail?id=67587#57
  28. Object.defineProperty(window.HTMLCanvasElement.prototype, 'toBlob', {
  29. value: function (callback: any, type: any, quality: any) {
  30. let bin = window.atob(this.toDataURL(type, quality).split(',')[ 1 ]);
  31. let len = bin.length;
  32. let len32 = len >> 2;
  33. let a8 = new Uint8Array(len);
  34. let a32 = new Uint32Array(a8.buffer, 0, len32);
  35. let j = 0;
  36. for (let i = 0; i < len32; i++) {
  37. a32[i] = (
  38. bin.charCodeAt(j++) |
  39. bin.charCodeAt(j++) << 8 |
  40. bin.charCodeAt(j++) << 16 |
  41. bin.charCodeAt(j++) << 24
  42. );
  43. }
  44. let tailLength = len & 3;
  45. while (tailLength--) {
  46. a8[ j ] = bin.charCodeAt(j++);
  47. }
  48. callback(new window.Blob([a8], { 'type': type || 'image/png' }));
  49. }
  50. });
  51. }
  52. // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/cbrt
  53. Math.cbrt = Math.cbrt || function (x) {
  54. let y = Math.pow(Math.abs(x), 1 / 3);
  55. return x < 0 ? -y : y;
  56. };
  57. // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sign
  58. if (!Math.sign) {
  59. Math.sign = function (x) {
  60. // If x is NaN, the result is NaN.
  61. // If x is -0, the result is -0.
  62. // If x is +0, the result is +0.
  63. // If x is negative and not -0, the result is -1.
  64. // If x is positive and not +0, the result is +1.
  65. x = +x; // convert to a number
  66. if (x === 0 || isNaN(x)) {
  67. return Number(x);
  68. }
  69. return x > 0 ? 1 : -1;
  70. };
  71. }
  72. if (!Number.isInteger) {
  73. // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isInteger
  74. Number.isInteger = function isInteger (nVal) {
  75. return typeof nVal === 'number' && isFinite(nVal) && nVal > -9007199254740992 && nVal < 9007199254740992 && Math.floor(nVal) === nVal;
  76. };
  77. }
  78. if (!Number.isNaN) {
  79. // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isNaN
  80. Number.isNaN = function isNaN (value) {
  81. return value !== value; // eslint-disable-line no-self-compare
  82. };
  83. }
  84. if (!Object.assign) {
  85. // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
  86. Object.defineProperty(Object, 'assign', {
  87. enumerable: false,
  88. configurable: true,
  89. writable: true,
  90. value: function (target: any/* , firstSource */) {
  91. 'use strict';
  92. if (target === undefined || target === null) { throw new TypeError('Cannot convert first argument to object'); }
  93. let to = Object(target);
  94. let hasPendingException = false;
  95. let pendingException;
  96. for (let i = 1; i < arguments.length; i++) {
  97. let nextSource = arguments[i];
  98. if (nextSource === undefined || nextSource === null) { continue; }
  99. let keysArray = Object.keys(Object(nextSource));
  100. for (let nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex++) {
  101. let nextKey = keysArray[nextIndex];
  102. try {
  103. let desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);
  104. if (desc !== undefined && desc.enumerable) { to[nextKey] = nextSource[nextKey]; }
  105. } catch (e) {
  106. if (!hasPendingException) {
  107. hasPendingException = true;
  108. pendingException = e;
  109. }
  110. }
  111. }
  112. if (hasPendingException) { throw pendingException; }
  113. }
  114. return to;
  115. }
  116. });
  117. }
  118. if (!String.prototype.startsWith) {
  119. /* ! https://mths.be/startswith v0.2.0 by @mathias */
  120. (function () {
  121. 'use strict'; // needed to support `apply`/`call` with `undefined`/`null`
  122. let defineProperty = (function () {
  123. // IE 8 only supports `Object.defineProperty` on DOM elements
  124. let result;
  125. try {
  126. let object = {};
  127. let $defineProperty = Object.defineProperty;
  128. result = $defineProperty(object, object as any, object) && $defineProperty;
  129. } catch (error) {} // eslint-disable-line no-empty
  130. return result;
  131. }());
  132. let toString = {}.toString;
  133. let startsWith = function (this: any, search: any) {
  134. if (this === null) {
  135. throw TypeError();
  136. }
  137. let string = String(this);
  138. if (search && toString.call(search) === '[object RegExp]') {
  139. throw TypeError();
  140. }
  141. let stringLength = string.length;
  142. let searchString = String(search);
  143. let searchLength = searchString.length;
  144. let position = arguments.length > 1 ? arguments[1] : undefined;
  145. // `ToInteger`
  146. let pos = position ? Number(position) : 0;
  147. if (Number.isNaN(pos)) {
  148. pos = 0;
  149. }
  150. let start = Math.min(Math.max(pos, 0), stringLength);
  151. // Avoid the `indexOf` call if no match is possible
  152. if (searchLength + start > stringLength) {
  153. return false;
  154. }
  155. let index = -1;
  156. while (++index < searchLength) {
  157. if (string.charCodeAt(start + index) !== searchString.charCodeAt(index)) {
  158. return false;
  159. }
  160. }
  161. return true;
  162. };
  163. if (defineProperty) {
  164. defineProperty(String.prototype, 'startsWith', {
  165. 'value': startsWith,
  166. 'configurable': true,
  167. 'writable': true
  168. });
  169. } else {
  170. // eslint-disable-next-line no-extend-native
  171. String.prototype.startsWith = startsWith;
  172. }
  173. }());
  174. }
  175. if (!String.prototype.endsWith) {
  176. // eslint-disable-next-line no-extend-native
  177. String.prototype.endsWith = function (searchString, position) {
  178. let subjectString = this.toString();
  179. if (typeof position !== 'number' || !isFinite(position) || Math.floor(position) !== position || position > subjectString.length) {
  180. position = subjectString.length;
  181. }
  182. position -= searchString.length;
  183. let lastIndex = subjectString.indexOf(searchString, position);
  184. return lastIndex !== -1 && lastIndex === position;
  185. };
  186. }
  187. if (!String.prototype.repeat) {
  188. // eslint-disable-next-line no-extend-native
  189. String.prototype.repeat = function (count) {
  190. 'use strict';
  191. if (this === null) {
  192. throw new TypeError('can\'t convert ' + this + ' to object');
  193. }
  194. let str = '' + this;
  195. count = +count;
  196. if (Number.isNaN(count)) {
  197. count = 0;
  198. }
  199. if (count < 0) {
  200. throw new RangeError('repeat count must be non-negative');
  201. }
  202. if (count === Infinity) {
  203. throw new RangeError('repeat count must be less than infinity');
  204. }
  205. count = Math.floor(count);
  206. if (str.length === 0 || count === 0) {
  207. return '';
  208. }
  209. // Ensuring count is a 31-bit integer allows us to heavily optimize the
  210. // main part. But anyway, most current (August 2014) browsers can't handle
  211. // strings 1 << 28 chars or longer, so:
  212. if (str.length * count >= 1 << 28) {
  213. throw new RangeError('repeat count must not overflow maximum string size');
  214. }
  215. let rpt = '';
  216. for (;;) {
  217. if ((count & 1) === 1) {
  218. rpt += str;
  219. }
  220. count >>>= 1;
  221. if (count === 0) {
  222. break;
  223. }
  224. str += str;
  225. }
  226. // Could we try:
  227. // return Array(count + 1).join(this);
  228. return rpt;
  229. };
  230. }
  231. if (!String.prototype.includes) {
  232. // eslint-disable-next-line no-extend-native
  233. String.prototype.includes = function (search, start) {
  234. 'use strict';
  235. if (typeof start !== 'number') {
  236. start = 0;
  237. }
  238. if (start + search.length > this.length) {
  239. return false;
  240. } else {
  241. return this.indexOf(search, start) !== -1;
  242. }
  243. };
  244. }
  245. if (!Array.prototype.includes) {
  246. // eslint-disable-next-line no-extend-native
  247. Array.prototype.includes = function (searchElement /* , fromIndex */) {
  248. 'use strict';
  249. if (this == null) {
  250. throw new TypeError('Array.prototype.includes called on null or undefined');
  251. }
  252. let O = Object(this);
  253. let len = parseInt(O.length, 10) || 0;
  254. if (len === 0) {
  255. return false;
  256. }
  257. let n = parseInt(arguments[1], 10) || 0;
  258. let k;
  259. if (n >= 0) {
  260. k = n;
  261. } else {
  262. k = len + n;
  263. if (k < 0) { k = 0; }
  264. }
  265. let currentElement;
  266. while (k < len) {
  267. currentElement = O[k];
  268. if (searchElement === currentElement ||
  269. (Number.isNaN(searchElement) && Number.isNaN(currentElement))
  270. ) {
  271. return true;
  272. }
  273. k++;
  274. }
  275. return false;
  276. };
  277. }
  278. // Production steps of ECMA-262, Edition 6, 22.1.2.1
  279. // Reference: https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.from
  280. if (!Array.from) {
  281. Array.from = (function () {
  282. let toStr = Object.prototype.toString;
  283. let isCallable = function (fn: any) {
  284. return typeof fn === 'function' || toStr.call(fn) === '[object Function]';
  285. };
  286. let toInteger = function (value: any) {
  287. let number = Number(value);
  288. if (isNaN(number)) { return 0; }
  289. if (number === 0 || !isFinite(number)) { return number; }
  290. return (number > 0 ? 1 : -1) * Math.floor(Math.abs(number));
  291. };
  292. let maxSafeInteger = Math.pow(2, 53) - 1;
  293. let toLength = function (value: any) {
  294. let len = toInteger(value);
  295. return Math.min(Math.max(len, 0), maxSafeInteger);
  296. };
  297. // The length property of the from method is 1.
  298. return function from (this: any, arrayLike: any/* , mapFn, thisArg */) {
  299. // 1. Let C be the this value.
  300. let C = this;
  301. // 2. Let items be ToObject(arrayLike).
  302. let items = Object(arrayLike);
  303. // 3. ReturnIfAbrupt(items).
  304. if (arrayLike == null) {
  305. throw new TypeError('Array.from requires an array-like object - not null or undefined');
  306. }
  307. // 4. If mapfn is undefined, then let mapping be false.
  308. let mapFn = arguments.length > 1 ? arguments[1] : void undefined;
  309. let T;
  310. if (typeof mapFn !== 'undefined') {
  311. // 5. else
  312. // 5. a If IsCallable(mapfn) is false, throw a TypeError exception.
  313. if (!isCallable(mapFn)) {
  314. throw new TypeError('Array.from: when provided, the second argument must be a function');
  315. }
  316. // 5. b. If thisArg was supplied, let T be thisArg; else let T be undefined.
  317. if (arguments.length > 2) {
  318. T = arguments[2];
  319. }
  320. }
  321. // 10. Let lenValue be Get(items, "length").
  322. // 11. Let len be ToLength(lenValue).
  323. let len = toLength(items.length);
  324. // 13. If IsConstructor(C) is true, then
  325. // 13. a. Let A be the result of calling the [[Construct]] internal method of C with an argument list containing the single item len.
  326. // 14. a. Else, Let A be ArrayCreate(len).
  327. let A = isCallable(C) ? Object(new C(len)) : new Array(len);
  328. // 16. Let k be 0.
  329. let k = 0;
  330. // 17. Repeat, while k < len… (also steps a - h)
  331. let kValue;
  332. while (k < len) {
  333. kValue = items[k];
  334. if (mapFn) {
  335. A[k] = typeof T === 'undefined' ? mapFn(kValue, k) : mapFn.call(T, kValue, k);
  336. } else {
  337. A[k] = kValue;
  338. }
  339. k += 1;
  340. }
  341. // 18. Let putStatus be Put(A, "length", len, true).
  342. A.length = len;
  343. // 20. Return A.
  344. return A;
  345. };
  346. }());
  347. }
  348. if (typeof window !== 'undefined') {
  349. (function () {
  350. // http://paulirish.com/2011/requestanimationframe-for-smart-animating/
  351. // http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
  352. // requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
  353. // MIT license
  354. let lastTime = 0;
  355. let vendors = ['ms', 'moz', 'webkit', 'o'];
  356. for (let x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
  357. window.requestAnimationFrame = (
  358. (window as any)[ vendors[ x ] + 'RequestAnimationFrame' ]
  359. );
  360. window.cancelAnimationFrame = (
  361. (window as any)[ vendors[ x ] + 'CancelAnimationFrame' ] ||
  362. (window as any)[ vendors[ x ] + 'CancelRequestAnimationFrame' ]
  363. );
  364. }
  365. if (!window.requestAnimationFrame) {
  366. window.requestAnimationFrame = function (callback/* , element */) {
  367. let currTime = new Date().getTime();
  368. let timeToCall = Math.max(0, 16 - (currTime - lastTime));
  369. let id = window.setTimeout(function () {
  370. let time = currTime + timeToCall;
  371. callback(time);
  372. }, timeToCall);
  373. lastTime = currTime + timeToCall;
  374. return id;
  375. };
  376. }
  377. if (!window.cancelAnimationFrame) {
  378. window.cancelAnimationFrame = function (id) {
  379. clearTimeout(id);
  380. };
  381. }
  382. }());
  383. }
  384. if (Function.prototype.name === undefined && Object.defineProperty !== undefined) {
  385. // Missing in IE9-11.
  386. // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/name
  387. // eslint-disable-next-line no-extend-native
  388. Object.defineProperty(Function.prototype, 'name', {
  389. get: function () {
  390. return this.toString().match(/^\s*function\s*(\S*)\s*\(/)[ 1 ];
  391. }
  392. });
  393. }
  394. if (typeof window !== 'undefined') {
  395. if (window.performance === undefined) {
  396. /* global self */
  397. (window as any).performance = {};
  398. }
  399. if (window.performance.now === undefined) {
  400. (function () {
  401. let start = Date.now();
  402. window.performance.now = function () {
  403. return Date.now() - start;
  404. };
  405. })();
  406. }
  407. }
  408. if (Object.defineProperty !== undefined) {
  409. // Missing in IE < 13
  410. // MIT license
  411. // Copyright (c) 2016 Financial Times
  412. // https://github.com/Financial-Times/polyfill-service
  413. if (Number.MAX_SAFE_INTEGER === undefined) {
  414. Object.defineProperty(Number, 'MAX_SAFE_INTEGER', {
  415. enumerable: false,
  416. configurable: false,
  417. writable: false,
  418. value: Math.pow(2, 53) - 1
  419. });
  420. }
  421. if (Number.MIN_SAFE_INTEGER === undefined) {
  422. Object.defineProperty(Number, 'MIN_SAFE_INTEGER', {
  423. enumerable: false,
  424. configurable: false,
  425. writable: false,
  426. value: -(Math.pow(2, 53) - 1)
  427. });
  428. }
  429. }
  430. if (!Object.entries) {
  431. Object.entries = function(obj: any){
  432. let ownProps = Object.keys( obj ),
  433. i = ownProps.length,
  434. resArray = new Array(i); // preallocate the Array
  435. while (i--)
  436. resArray[i] = [ownProps[i], obj[ownProps[i]]];
  437. return resArray;
  438. };
  439. }
  440. // from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find
  441. // https://tc39.github.io/ecma262/#sec-array.prototype.find
  442. if (!Array.prototype.find) {
  443. Object.defineProperty(Array.prototype, 'find', {
  444. value: function(predicate: any) {
  445. // 1. Let O be ? ToObject(this value).
  446. if (this == null) {
  447. throw TypeError('"this" is null or not defined');
  448. }
  449. let o = Object(this);
  450. // 2. Let len be ? ToLength(? Get(O, "length")).
  451. let len = o.length >>> 0;
  452. // 3. If IsCallable(predicate) is false, throw a TypeError exception.
  453. if (typeof predicate !== 'function') {
  454. throw TypeError('predicate must be a function');
  455. }
  456. // 4. If thisArg was supplied, let T be thisArg; else let T be undefined.
  457. let thisArg = arguments[1];
  458. // 5. Let k be 0.
  459. let k = 0;
  460. // 6. Repeat, while k < len
  461. while (k < len) {
  462. // a. Let Pk be ! ToString(k).
  463. // b. Let kValue be ? Get(O, Pk).
  464. // c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)).
  465. // d. If testResult is true, return kValue.
  466. let kValue = o[k];
  467. if (predicate.call(thisArg, kValue, k, o)) {
  468. return kValue;
  469. }
  470. // e. Increase k by 1.
  471. k++;
  472. }
  473. // 7. Return undefined.
  474. return undefined;
  475. },
  476. configurable: true,
  477. writable: true
  478. });
  479. }
  480. // from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/fill
  481. if (!Array.prototype.fill) {
  482. Object.defineProperty(Array.prototype, 'fill', {
  483. value: function(value: any) {
  484. // Steps 1-2.
  485. if (this == null) {
  486. throw new TypeError('this is null or not defined');
  487. }
  488. let O = Object(this);
  489. // Steps 3-5.
  490. let len = O.length >>> 0;
  491. // Steps 6-7.
  492. let start = arguments[1];
  493. let relativeStart = start >> 0;
  494. // Step 8.
  495. let k = relativeStart < 0 ?
  496. Math.max(len + relativeStart, 0) :
  497. Math.min(relativeStart, len);
  498. // Steps 9-10.
  499. let end = arguments[2];
  500. let relativeEnd = end === undefined ?
  501. len : end >> 0;
  502. // Step 11.
  503. let finalValue = relativeEnd < 0 ?
  504. Math.max(len + relativeEnd, 0) :
  505. Math.min(relativeEnd, len);
  506. // Step 12.
  507. while (k < finalValue) {
  508. O[k] = value;
  509. k++;
  510. }
  511. // Step 13.
  512. return O;
  513. }
  514. });
  515. }
  516. if (!Array.prototype.copyWithin) {
  517. Object.defineProperty(Array.prototype, 'copyWithin', {
  518. value: function(target: any, start: any/* , end*/) {
  519. // Steps 1-2.
  520. if (this == null) {
  521. throw new TypeError('this is null or not defined');
  522. }
  523. let O = Object(this);
  524. // Steps 3-5.
  525. let len = O.length >>> 0;
  526. // Steps 6-8.
  527. let relativeTarget = target >> 0;
  528. let to = relativeTarget < 0 ?
  529. Math.max(len + relativeTarget, 0) :
  530. Math.min(relativeTarget, len);
  531. // Steps 9-11.
  532. let relativeStart = start >> 0;
  533. let from = relativeStart < 0 ?
  534. Math.max(len + relativeStart, 0) :
  535. Math.min(relativeStart, len);
  536. // Steps 12-14.
  537. let end = arguments[2];
  538. let relativeEnd = end === undefined ? len : end >> 0;
  539. let final = relativeEnd < 0 ?
  540. Math.max(len + relativeEnd, 0) :
  541. Math.min(relativeEnd, len);
  542. // Step 15.
  543. let count = Math.min(final - from, len - to);
  544. // Steps 16-17.
  545. let direction = 1;
  546. if (from < to && to < (from + count)) {
  547. direction = -1;
  548. from += count - 1;
  549. to += count - 1;
  550. }
  551. // Step 18.
  552. while (count > 0) {
  553. if (from in O) {
  554. O[to] = O[from];
  555. } else {
  556. delete O[to];
  557. }
  558. from += direction;
  559. to += direction;
  560. count--;
  561. }
  562. // Step 19.
  563. return O;
  564. },
  565. configurable: true,
  566. writable: true
  567. });
  568. }
  569. if (!Int8Array.prototype.copyWithin) {
  570. Object.defineProperty(Int8Array.prototype, 'copyWithin', { value: Array.prototype.copyWithin });
  571. }
  572. if (!Int16Array.prototype.copyWithin) {
  573. Object.defineProperty(Int16Array.prototype, 'copyWithin', { value: Array.prototype.copyWithin });
  574. }
  575. if (!Int32Array.prototype.copyWithin) {
  576. Object.defineProperty(Int32Array.prototype, 'copyWithin', { value: Array.prototype.copyWithin });
  577. }
  578. if (!Uint8Array.prototype.copyWithin) {
  579. Object.defineProperty(Uint8Array.prototype, 'copyWithin', { value: Array.prototype.copyWithin });
  580. }
  581. if (!Uint16Array.prototype.copyWithin) {
  582. Object.defineProperty(Uint16Array.prototype, 'copyWithin', { value: Array.prototype.copyWithin });
  583. }
  584. if (!Uint32Array.prototype.copyWithin) {
  585. Object.defineProperty(Uint32Array.prototype, 'copyWithin', { value: Array.prototype.copyWithin });
  586. }
  587. if (!Float32Array.prototype.copyWithin) {
  588. Object.defineProperty(Float32Array.prototype, 'copyWithin', { value: Array.prototype.copyWithin });
  589. }
  590. if (!Float64Array.prototype.copyWithin) {
  591. Object.defineProperty(Float64Array.prototype, 'copyWithin', { value: Array.prototype.copyWithin });
  592. }