1 | var testMap = new Map();
|
2 | if (testMap.set(1, 2) !== testMap) {
|
3 | var set_1 = testMap.set;
|
4 | Map.prototype.set = function () {
|
5 | var args = [];
|
6 | for (var _i = 0; _i < arguments.length; _i++) {
|
7 | args[_i] = arguments[_i];
|
8 | }
|
9 | set_1.apply(this, args);
|
10 | return this;
|
11 | };
|
12 | }
|
13 | var testSet = new Set();
|
14 | if (testSet.add(3) !== testSet) {
|
15 | var add_1 = testSet.add;
|
16 | Set.prototype.add = function () {
|
17 | var args = [];
|
18 | for (var _i = 0; _i < arguments.length; _i++) {
|
19 | args[_i] = arguments[_i];
|
20 | }
|
21 | add_1.apply(this, args);
|
22 | return this;
|
23 | };
|
24 | }
|
25 | var frozen = {};
|
26 | if (typeof Object.freeze === 'function') {
|
27 | Object.freeze(frozen);
|
28 | }
|
29 | try {
|
30 | testMap.set(frozen, frozen).delete(frozen);
|
31 | }
|
32 | catch (_a) {
|
33 | var wrap = function (method) {
|
34 | return method && (function (obj) {
|
35 | try {
|
36 | testMap.set(obj, obj).delete(obj);
|
37 | }
|
38 | finally {
|
39 | return method.call(Object, obj);
|
40 | }
|
41 | });
|
42 | };
|
43 | Object.freeze = wrap(Object.freeze);
|
44 | Object.seal = wrap(Object.seal);
|
45 | Object.preventExtensions = wrap(Object.preventExtensions);
|
46 | }
|
47 | export {};
|
48 |
|
\ | No newline at end of file |