Thanks to visit codestin.com
Credit goes to github.com

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

Conversation

olizilla
Copy link
Member

@olizilla olizilla commented Jul 3, 2019

first step on the road to implmenting @ianjdarrow's https://github.com/ianjdarrow/content-decider (thanks @mikeal ;-)

@olizilla
Copy link
Member Author

olizilla commented Jul 3, 2019

See also ipfs/notes#284

async putMany (blocks) {
if (this._decider) {
blocks = blocks.map(b => this._decider(b).then(allowed => allowed ? block : null))
blocks = (await Promise.all(blocks)).filter(x => x)
Copy link
Member

Choose a reason for hiding this comment

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

FYI: .filter(x => x) can also be written as .filter(Boolean).

* @param {IPFSRepo} ipfsRepo
*/
constructor (ipfsRepo) {
constructor (ipfsRepo, decider) {
Copy link
Member

Choose a reason for hiding this comment

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

If this is optional can it please go in an options object?

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.

3 participants