]>
Commit | Line | Data |
---|---|---|
3f7ac48b JF |
1 | let $cy_set = function(object, properties) { |
2 | for (const name in properties) | |
3 | Object.defineProperty(object, name, { | |
4 | configurable: true, | |
5 | enumerable: false, | |
6 | writable: true, | |
7 | value: properties[name], | |
8 | }); | |
9 | }; | |
10 | ||
11 | $cy_set(Date.prototype, { | |
12 | toCYON: function() { | |
13 | return `new ${this.constructor.name}(${this.toUTCString().toCYON()})`; | |
14 | }, | |
15 | }); | |
16 | ||
17 | $cy_set(Error.prototype, { | |
18 | toCYON: function() { | |
19 | return `new ${this.constructor.name}(${this.message.toCYON()})`; | |
20 | }, | |
21 | }); |