Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added new global setting to ignore prototypes. #32

Merged
merged 2 commits into from Jun 25, 2015

Conversation

@arb
Copy link
Contributor

arb commented Jun 25, 2015

This will allow you to ignore the prototype object for all deep object comparisons.

@arb arb added the feature label Jun 25, 2015
@@ -167,9 +168,11 @@ internals.addMethod('length', function (size) {

internals.addMethod(['equal', 'equals'], function (value, options) {

options = options || {};
var settings = Hoek.applyToDefaults(exports.settings, options);

This comment has been minimized.

Copy link
@cjihrig

cjihrig Jun 25, 2015

Contributor

We don't want to pass all of exports.settings to Hoek. The defaults can be { prototype: exports.settings.prototype }.

}

Hoek.assert(!exception, exception);
Code.settings.prototype = origPrototype;

This comment has been minimized.

Copy link
@cjihrig

cjihrig Jun 25, 2015

Contributor

These two lines need to be reversed (restore the original value before performing any assertions).

@@ -14,7 +14,8 @@ var internals = {
};

exports.settings = {
truncateMessages: true
truncateMessages: true,
prototype: true

This comment has been minimized.

Copy link
@cjihrig

cjihrig Jun 25, 2015

Contributor

I'm not huge on using the name prototype, since these settings apply to the entire module, not just deep.equal(). I don't really have a better idea except maybe comparePrototypes.

@cjihrig

This comment has been minimized.

Copy link
Contributor

cjihrig commented Jun 25, 2015

Thanks for doing this!

@cjihrig cjihrig self-assigned this Jun 25, 2015
@cjihrig cjihrig added this to the 1.5.0 milestone Jun 25, 2015
cjihrig added a commit that referenced this pull request Jun 25, 2015
Added new global setting to ignore prototypes.
@cjihrig cjihrig merged commit a922649 into hapijs:master Jun 25, 2015
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@arb arb deleted the arb:prototype branch Jun 25, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.