Skip to content

Commit

Permalink
assert: remove unnecessary use of __proto__
Browse files Browse the repository at this point in the history
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 9eddaeb
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/assert.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 9eddaeb

Please sign in to comment.