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

Commit

Permalink
feat: make addFormat() and removeFormat() return the instance
Browse files Browse the repository at this point in the history
This way you can chain addFormat()/removeFormat() calls.
  • Loading branch information
vmx committed Mar 21, 2019
1 parent 95536cd commit 5f62fe0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class IPLDResolver {
* Add support for an IPLD Format.
*
* @param {Object} format - The implementation of an IPLD Format.
* @returns {void}
* @returns {this}
*/
addFormat (format) {
// IPLD Formats are using strings instead of constants for the multicodec
Expand All @@ -59,18 +59,22 @@ class IPLDResolver {
resolver: format.resolver,
util: format.util
}

return this
}

/**
* Remove support for an IPLD Format.
*
* @param {number} codec - The codec of the IPLD Format to remove.
* @returns {void}
* @returns {this}
*/
removeFormat (codec) {
if (this.resolvers[codec]) {
delete this.resolvers[codec]
}

return this
}

/**
Expand Down

0 comments on commit 5f62fe0

Please sign in to comment.