Skip to content
This repository has been archived by the owner on Aug 11, 2021. It is now read-only.

API update #80

Merged
merged 11 commits into from
Mar 13, 2017
Merged

API update #80

merged 11 commits into from
Mar 13, 2017

Conversation

daviddias
Copy link
Member

@daviddias daviddias commented Mar 9, 2017

@daviddias daviddias added the status/in-progress In progress label Mar 9, 2017
@daviddias daviddias self-assigned this Mar 9, 2017
@daviddias
Copy link
Member Author

@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()
Copy link
Member

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

Copy link
Member Author

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?

@@ -113,7 +113,7 @@ module.exports = (repo) => {
})
})

describe('public api', () => {
describe.only('public api', () => {
Copy link
Member

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()
})
})
}
Copy link
Member

@dignifiedquire dignifiedquire Mar 13, 2017

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))
Copy link
Member

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

Copy link
Member Author

@daviddias daviddias Mar 13, 2017

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

@daviddias daviddias merged commit fac519f into master Mar 13, 2017
@daviddias daviddias deleted the feat/api-update branch March 13, 2017 13:39
@daviddias daviddias removed the status/in-progress In progress label Mar 13, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants