You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is an attempt at implementing #203, converting the CID class
into a minimal interface and having factory functions to return
objects that conform to the CID interface.
I've preserved all the generics the `Link` interface introduced and
there are functions in `link.js` that add the extra methods to turn
something that conforms to `CID` into something that can be used as
a `Link` so existing code using the `Link` API should not have to
change.
Notably there was no need to update any of the `Link` tests.
The static methods on CID have been exported as individual functions
- the names remain the same (`decode`, `parse`, etc) in an attempt
to be less disruptive.
Code using these methods should mostly just need to change:
```js
import { CID } from 'multiformats/cid'
```
to:
```js
import * as CID from 'multiformats/cid
```
Types can be imported as:
```ts
import type { CID } from 'multiformats/interface'
```
or as before:
```ts
import type { CID } from 'multiformats/cid'
```
BREAKING CHANGE: the CID class is now an interface
0 commit comments