File tree 1 file changed +14
-9
lines changed
1 file changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -135,15 +135,20 @@ the default behavior of `console` in Node.js.
135
135
136
136
// Creates a simple extension of console with a
137
137
// new impl for assert without monkey-patching.
138
- const myConsole = Object .setPrototypeOf ({
139
- assert (assertion , message , ... args ) {
140
- try {
141
- console .assert (assertion, message, ... args);
142
- } catch (err) {
143
- console .error (err .stack );
144
- }
145
- }
146
- }, console );
138
+ const myConsole = Object .create (console , {
139
+ assert: {
140
+ value : function assert (assertion , message , ... args ) {
141
+ try {
142
+ console .assert (assertion, message, ... args);
143
+ } catch (err) {
144
+ console .error (err .stack );
145
+ }
146
+ },
147
+ configurable: true ,
148
+ enumerable: true ,
149
+ writable: true ,
150
+ },
151
+ });
147
152
148
153
module .exports = myConsole;
149
154
```
You can’t perform that action at this time.
0 commit comments