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
Fixes#249
- update aegir to get latest linter rules
- minimal changes to vendored code
- eslint-disable files, add inferred types as jsdocs, move vendor directory under src
- convert all .js files to .ts
- apply all jsdoc type annotations as typescript type annotations
- fix all resulting linter and type issues
- Special attention given to keep any helpful jsdocs
BREAKING CHANGE: this module is now TypeScript - the API has not changed but releasing as a major for saftey
---------
Co-authored-by: Alex Potsides <alex@achingbrain.net>
This library defines common interfaces and low level building blocks for various interrelated multiformat technologies (multicodec, multihash, multibase, and CID). They can be used to implement custom base encoders / decoders / codecs, codec encoders /decoders and multihash hashers that comply to the interface that layers above assume.
45
10
46
11
This library provides implementations for most basics and many others can be found in linked repositories.
CIDs can be serialized to string representation using multibase encoders that implement [`MultibaseEncoder`](https://github.com/multiformats/js-multiformats/blob/master/src/bases/interface.ts) interface. This library provides quite a few implementations that can be imported:
Parsing CID string serialized CIDs requires multibase decoder that implements [`MultibaseDecoder`](https://github.com/multiformats/js-multiformats/blob/master/src/bases/interface.ts) interface. This library provides a decoder for every encoder it provides:
This library defines [`BlockEncoder`, `BlockDecoder` and `BlockCodec` interfaces](https://github.com/multiformats/js-multiformats/blob/master/src/codecs/interface.ts).
129
94
Codec implementations should conform to the `BlockCodec` interface which implements both `BlockEncoder` and `BlockDecoder`.
130
95
Here is an example implementation of JSON `BlockCodec`.
This library defines [`MultihashHasher` and `MultihashDigest` interfaces](https://github.com/multiformats/js-multiformats/blob/master/src/hashes/interface.ts) and convinient function for implementing them:
This library contains higher-order functions for traversing graphs of data easily.
170
131
171
132
`walk()` walks through the links in each block of a DAG calling a user-supplied loader function for each one, in depth-first order with no duplicate block visits. The loader should return a `Block` object and can be used to inspect and collect block ordering for a full DAG walk. The loader should `throw` on error, and return `null` if a block should be skipped by `walk()`.
172
133
173
-
```js
134
+
```TypeScript
174
135
import { walk } from'multiformats/traversal'
175
136
import*asBlockfrom'multiformats/block'
176
137
import*ascodecfrom'multiformats/codecs/json'
@@ -243,17 +204,31 @@ Other (less useful) bases implemented in [multiformats/js-multiformats](https://
- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)
256
231
257
-
##Contribution
232
+
# Contribution
258
233
259
234
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
0 commit comments