Skip to content

Check explicitly for DAGLink instance. #37

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

Merged
merged 2 commits into from
Jun 2, 2016

Conversation

hackergrrl
Copy link
Contributor

Includes previously failing test, occurring when passing in a DAGLink instance with no name.

@@ -51,7 +51,7 @@ module.exports = class DAGNode {
// ensure links are instances of DAGLink
if (links) {
links.forEach((l) => {
if (l.name && typeof l.toJSON === 'function') {
if (l instanceof DAGLink) {
Copy link
Member

Choose a reason for hiding this comment

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

No! you can not do that (sadly). We explicitly removed this because this will fail if there are two different versions of this module are used. And will give you many false negatives in that case

Copy link
Contributor Author

@hackergrrl hackergrrl May 24, 2016

Choose a reason for hiding this comment

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

Yeah, I just ran into this the other day. Let's check constructor instead -- I think that will be more reliable. Thanks for catching this.

@hackergrrl
Copy link
Contributor Author

ping @vijayee

@daviddias
Copy link
Member

LGTM :)

@daviddias daviddias merged commit 90e52de into ipfs:master Jun 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants