-
Notifications
You must be signed in to change notification settings - Fork 37
Conversation
@dignifiedquire would like your review on this PR, I'm sure your fresh view will bring a clear perspective on how to simplify it. I'll also look into it again tomorrow rested :) |
src/index.js
Outdated
options = options || {} | ||
|
||
// non recursive | ||
const p = pullPushable() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do you need to use a push stream? you should be able to return source stream that only walks the next thing if it actually needs to
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wanna exemplify what you mean?
test/ipld-dag-cbor.js
Outdated
@@ -113,7 +113,7 @@ module.exports = (repo) => { | |||
}) | |||
}) | |||
|
|||
describe('public api', () => { | |||
describe.only('public api', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove
src/index.js
Outdated
p.end() | ||
}) | ||
}) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this could be written as
if (!options.recursive) {
p = pullDefer.source()
waterfall([
(cb) => this.bs.get(cid, cb),
(block, cb) => r.resolver.tree(block, cb)
], (err, paths) => {
if (err) {
return p.abort(err)
}
p.resolve(pull.values(paths))
})
}
src/index.js
Outdated
} | ||
}), | ||
pull.filter((el) => el && el.length > 0), | ||
pullSort((a, b) => a.localeCompare(b)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pullSort
has to buffer everything, you should try and avoid this sorting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion being: let the user do the sorting themselves? sgtm if that is what you propose
Needs: