Skip to content
This repository has been archived by the owner on Jul 21, 2023. It is now read-only.

feat: allow configurable validators and selectors #57

Merged
merged 2 commits into from
Nov 29, 2018

Conversation

vasco-santos
Copy link
Member

@vasco-santos vasco-santos commented Nov 29, 2018

Allow configurable validators and selectors. Users of libp2p-kad-dht must be able to set their own validators and selectors.

For instance, this is important for js-ipfs to use /ipns/ namespaces in the DHT

@ghost ghost assigned vasco-santos Nov 29, 2018
@ghost ghost added the status/in-progress In progress label Nov 29, 2018
Copy link
Contributor

@jacobheun jacobheun left a comment

Choose a reason for hiding this comment

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

Other than a small nit, this looks good!

src/index.js Outdated
*/
constructor (sw, options) {
assert(sw, 'libp2p-kad-dht requires a instance of Switch')
options = options || {}
options.validators = options.validators || {}
options.selectors = options.selectors || {}
Copy link
Contributor

Choose a reason for hiding this comment

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

This is unnecessary isn't it? The spread operator will ignore undefined and null.

Copy link
Member Author

Choose a reason for hiding this comment

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

Just tested it. You are right, removed the fallback 😀

@vasco-santos vasco-santos merged commit b731a1d into master Nov 29, 2018
@ghost ghost removed the status/in-progress In progress label Nov 29, 2018
@vasco-santos vasco-santos deleted the feat/allow-configurable-validators-and-selectors branch November 29, 2018 17:31
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