-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,15 +50,17 @@ module.exports = class DAGNode { | |
|
||
// ensure links are instances of DAGLink | ||
if (links) { | ||
links.map((l) => { | ||
return { | ||
size: l.size || l.Size, | ||
name: l.name || l.Name, | ||
hash: l.hash || l.Hash | ||
links.forEach((l) => { | ||
if (l.name && typeof l.toJSON === 'function') { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
daviddias
Member
|
||
this.links.push(l) | ||
} else { | ||
this.links.push( | ||
new DAGLink(l.Name, l.Size, l.Hash) | ||
) | ||
} | ||
}).forEach((l) => { | ||
this.addRawLink(l) | ||
}) | ||
|
||
stable.inplace(this.links, linkSort) | ||
} | ||
} | ||
|
||
|
I'm hitting an error here when calling
new DAGNode(data, links)
iflinks
includes DAGLink objects with empty names, as they are not recognized as DAGLink objects. Are link names allowed to be null or empty string? Based on the go implementation I thought this was the case. What aboutif (l instanceof DAGLink)
instead?