Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: convert to interface #274

Merged
merged 3 commits into from
Sep 21, 2022
Merged

feat!: convert to interface #274

merged 3 commits into from
Sep 21, 2022

Conversation

achingbrain
Copy link
Member

@achingbrain achingbrain commented Sep 20, 2022

  • Renames the Multiaddr class to DefaultMultiaddr
  • Exports Multiaddr as an interface

The multiaddr function (introduced in v9.0.0) should be used to create new instances of Multiaddr instead of instantiating the Multiaddr class directly.

This allows us to remove the inspect symbol from the interface and avoid use of Object.defineProperty which is very slow:

image

Fixes: #202

BREAKING CHANGE: the Multiaddr class is now an interface

- Renames the `Multiaddr` class to `DefaultMultiaddr`
- Exports `Multiaddr` as an interface

The `multiaddr` function should be used to create new instances of
`Multiaddr` (introduced in v9.0.0) instead of instantiating the
`Multiaddr` class directly.

This allows us to remove the `inspect` symbol from the interface
and avoid use of `Object.defineProperty` which is very slow.

BREAKING CHANGE: the `Multiaddr` class is now an interface
@achingbrain
Copy link
Member Author

cc @wemeetagain

Copy link
Contributor

@wemeetagain wemeetagain left a comment

Choose a reason for hiding this comment

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

Hooray! the PR looks good to me

@achingbrain achingbrain merged commit 36de98f into master Sep 21, 2022
@achingbrain achingbrain deleted the feat/convert-to-interface branch September 21, 2022 05:32
github-actions bot pushed a commit that referenced this pull request Sep 21, 2022
## [11.0.0](v10.5.0...v11.0.0) (2022-09-21)

### ⚠ BREAKING CHANGES

* the `Multiaddr` class is now an interface

### Features

* convert to interface ([#274](#274)) ([36de98f](36de98f)), closes [#202](#202)

### Bug Fixes

* fix converting strings to IP addresses and back again ([#270](#270)) ([77f063a](77f063a))
@github-actions
Copy link

🎉 This PR is included in version 11.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replace Multiaddr class with an interface
2 participants