Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

assert: remove unnecessary use of __proto__

AssertionError already inherits from Error above using util.inherits(),
so this extra line was redundant.

test/simple/test-assert.js already tests for `instanceof`, and still passes.
  • Loading branch information
TooTallNate committed Jul 25, 2012
1 parent b207e24 commit 9eddaebb79ff1954b7ecdb209587d7db6554580d
Showing with 2 additions and 4 deletions.
  1. +2 −4 lib/assert.js
@@ -49,6 +49,8 @@ assert.AssertionError = function AssertionError(options) {
Error.captureStackTrace(this, stackStartFunction);
}
};

// assert.AssertionError instanceof Error
util.inherits(assert.AssertionError, Error);

function replacer(key, value) {
@@ -85,10 +87,6 @@ assert.AssertionError.prototype.toString = function() {
}
};

// assert.AssertionError instanceof Error

assert.AssertionError.__proto__ = Error.prototype;

// At present only the three keys mentioned above are used and
// understood by the spec. Implementations or sub modules can pass
// other keys to the AssertionError's constructor - they will be

1 comment on commit 9eddaeb

@AceMood

This comment has been minimized.

Copy link

AceMood commented on 9eddaeb Nov 11, 2015

Actually, it's definitely an ideal approach

Please sign in to comment.
You can’t perform that action at this time.