File tree Expand file tree Collapse file tree 1 file changed +14
-9
lines changed Expand file tree Collapse file tree 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.
135135
136136// Creates a simple extension of console with a
137137// 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+ });
147152
148153module .exports = myConsole;
149154```
You can’t perform that action at this time.
0 commit comments