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

doc: mention prototype check in deepStrictEqual() #5367

Closed
wants to merge 1 commit into from

Conversation

cjihrig
Copy link
Contributor

@cjihrig cjihrig commented Feb 22, 2016

The docs for assert.deepStrictEqual() do not currently mention that prototypes are compared for objects. This commit adds that information to the documentation.

Fixes: #5365

The docs for assert.deepStrictEqual() do not currently mention
that prototypes are compared for objects. This commit adds that
information to the documentation.

Fixes: nodejs#5365
@r-52 r-52 added assert Issues and PRs related to the assert subsystem. doc Issues and PRs related to the documentations. lts-watch-v4.x labels Feb 22, 2016
@cjihrig
Copy link
Contributor Author

cjihrig commented Feb 23, 2016

R=@nodejs/documentation

@eljefedelrodeodeljefe
Copy link
Contributor

LGTM

@benjamingr
Copy link
Member

I'm not sure I would understand what "object prototypes are included in the comparison" means - it might imply they need to have the same __proto__.

@cjihrig
Copy link
Contributor Author

cjihrig commented Feb 23, 2016

What about this?

Generally identical to `assert.deepEqual()` with two exceptions. First, primitive values
are compared using the strict equality operator ( `===` ). Second, object comparisons
include a strict equality check of their prototypes.

@benjamingr
Copy link
Member

That might still imply that their prototypes are checked and are expected to be equal (is that the case?) - what about:

Generally identical to assert.deepEqual() with two exceptions. First, primitive values
are compared using the strict equality operator ( === ). Second, object comparisons
include a strict equality check of properties on their prototypes.

@cjihrig
Copy link
Contributor Author

cjihrig commented Feb 23, 2016

It's actually a strict comparison of the prototypes. https://github.com/nodejs/node/blob/master/lib/assert.js#L199

@benjamingr
Copy link
Member

@cjihrig Oh, in that case my bad - LGTM

values are compared using the strict equality operator ( `===` ).
Generally identical to [`assert.deepEqual()`][] with the exceptions that
primitive values are compared using the strict equality operator ( `===` ), and
object prototypes are included in the comparison.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

object prototypes are included in the comparison.

seems a little vague to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See proposed change in the main thread.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would have been better if we could somehow say that prototypes should be the same. But yeah the proposed change also is okay.

@thefourtheye
Copy link
Contributor

LGTM

@cjihrig
Copy link
Contributor Author

cjihrig commented Feb 23, 2016

Thanks for the reviews. Landed in 10f55b0.

@cjihrig cjihrig closed this Feb 23, 2016
@cjihrig cjihrig deleted the 5365 branch February 23, 2016 14:21
@Fishrock123 Fishrock123 mentioned this pull request Mar 1, 2016
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
assert Issues and PRs related to the assert subsystem. doc Issues and PRs related to the documentations.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants