Skip to content

Commit 9067450

Browse files
committedApr 8, 2021
chore: update changelog with breaking change examples
1 parent ac7da1b commit 9067450

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed
 

‎CHANGELOG.md

+46
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,52 @@
66
* add types ([#189](https://github.com/multiformats/js-multiaddr/issues/189)) ([7d284e4](https://github.com/multiformats/js-multiaddr/commit/7d284e4ce9285b448cd1287af9702a62ff696d68))
77

88

9+
### BREAKING CHANGES
10+
11+
* entry point uses named exports
12+
13+
```js
14+
// before
15+
16+
const multiaddr = require('multiaddr')
17+
multiaddr.resolvers
18+
multiaddr.protocols
19+
20+
// after
21+
22+
const {multiaddr , Multiaddr, protocols, resolvers} = = require('multiaddr')
23+
Multiaddr.resolvers
24+
Multiaddr.protocols
25+
```
26+
- Multiaddr is a normal class now
27+
- `toOptions` output changed to match node
28+
```js
29+
// before
30+
multiaddr('/ip4/127.0.0.1/tcp/4001').toOptions()
31+
{ family: 'ipv4', host: '127.0.0.1', transport: 'tcp', port: 4001 }
32+
33+
// after
34+
new Multiaddr('/ip4/127.0.0.1/tcp/4001').toOptions()
35+
{ family: 4, host: '127.0.0.1', transport: 'tcp', port: 4001 }
36+
```
37+
- `fromNodeAddress` and `nodeAddress` inputs/outputs now match
38+
```js
39+
// before the family type was not the same between them
40+
multiaddr('/ip4/127.0.0.1/tcp/4001').nodeAddress()
41+
{family: 4, address: '127.0.0.1', port: '4001'}
42+
43+
multiaddr.fromNodeAddress({family: 'IPv4', address: '127.0.0.1', port: '4001'}, 'tcp')
44+
<Multiaddr 047f000001060fa1 - /ip4/127.0.0.1/tcp/4001>
45+
46+
// after
47+
new Multiaddr('/ip4/127.0.0.1/tcp/4001').nodeAddress()
48+
{family: 4, address: '127.0.0.1', port: 4001}
49+
50+
Multiaddr.fromNodeAddress({family: 4, address: '127.0.0.1', port: '4001'}, 'tcp')
51+
<Multiaddr 047f000001060fa1 - /ip4/127.0.0.1/tcp/4001>
52+
```
53+
54+
955

1056
## [8.1.2](https://github.com/multiformats/js-multiaddr/compare/v8.1.1...v8.1.2) (2020-12-11)
1157

0 commit comments

Comments
 (0)
Please sign in to comment.