1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 | import 'get-own-property-symbols/build/get-own-property-symbols.max';
|
13 |
|
14 |
|
15 | const toString = Object.prototype.toString;
|
16 | Object.prototype.toString = function () {
|
17 | if (this === undefined) {
|
18 | return '[object Undefined]';
|
19 | }
|
20 | else if (this === null) {
|
21 | return '[object Null]';
|
22 | }
|
23 | else {
|
24 | return toString.call(this);
|
25 | }
|
26 | };
|
27 |
|
28 | Object.keys = function (obj) {
|
29 | return Object.getOwnPropertyNames(obj).filter((name) => {
|
30 | const prop = Object.getOwnPropertyDescriptor(obj, name);
|
31 | return prop && prop.enumerable;
|
32 | });
|
33 | };
|
34 |
|
35 | if (!String.prototype[Symbol.iterator] || !String.prototype.codePointAt) {
|
36 | String.prototype[Symbol.iterator] = function* () {
|
37 | for (let i = 0; i < this.length; i++) {
|
38 | yield this[i];
|
39 | }
|
40 | };
|
41 | }
|
42 | if (!Set.prototype[Symbol.iterator]) {
|
43 | Set.prototype[Symbol.iterator] = function* () {
|
44 | const temp = [];
|
45 | this.forEach((value) => {
|
46 | temp.push(value);
|
47 | });
|
48 | for (let i = 0; i < temp.length; i++) {
|
49 | yield temp[i];
|
50 | }
|
51 | };
|
52 | }
|
53 | if (!Map.prototype[Symbol.iterator]) {
|
54 | Map.prototype[Symbol.iterator] = function* () {
|
55 | const entries = [];
|
56 | this.forEach((value, key) => {
|
57 | entries.push([key, value]);
|
58 | });
|
59 | for (let i = 0; i < entries.length; i++) {
|
60 | yield entries[i];
|
61 | }
|
62 | };
|
63 | }
|
64 |
|
\ | No newline at end of file |