This repository has been archived by the owner on Aug 24, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: update dep and fix types (#111)
- improve types - update deps
- Loading branch information
1 parent
5a5ee8e
commit 666c4ad
Showing
8 changed files
with
83 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { HashCode, HashName } from './constants.js' | ||
import type { HashCode, HashName } from './constants.js' | ||
|
||
export type CodeNameMap = Record<HashCode, HashName> | ||
export type NameCodeMap = Record<HashName, HashCode> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,15 @@ | ||
{ | ||
"extends": "./node_modules/aegir/src/config/tsconfig.aegir.json", | ||
"compilerOptions": { | ||
"outDir": "dist" | ||
"outDir": "dist", | ||
"baseUrl": "./", | ||
"paths": { | ||
"*": ["./types/*"] | ||
} | ||
}, | ||
"include": [ | ||
"test", // remove this line if you don't want to type-check tests | ||
"src" | ||
"src", | ||
"types" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
export const encode: { | ||
/** | ||
* Encodes `num` into `buffer` starting at `offset`. returns `buffer`, with the encoded varint written into it. | ||
* `varint.encode.bytes` will now be set to the number of bytes modified. | ||
*/ | ||
(num: number, buffer: Uint8Array, offset?: number): Uint8Array | ||
|
||
/** | ||
* Encodes `num` into `array` starting at `offset`. returns `array`, with the encoded varint written into it. | ||
* If `array` is not provided, it will default to a new array. | ||
* `varint.encode.bytes` will now be set to the number of bytes modified. | ||
*/ | ||
(num: number, array?: number[], offset?: number): number[] | ||
|
||
/** | ||
* Similar to `decode.bytes` when encoding a number it can be useful to know how many bytes where written (especially if you pass an output array). | ||
* You can access this via `varint.encode.bytes` which holds the number of bytes written in the last encode. | ||
*/ | ||
bytes: number | ||
} | ||
|
||
export const decode: { | ||
/** | ||
* Decodes `data`, which can be either a buffer or array of integers, from position `offset` or default 0 and returns the decoded original integer. | ||
* Throws a `RangeError` when `data` does not represent a valid encoding. | ||
*/ | ||
(buf: Uint8Array | Buffer | number[], offset?: number): number | ||
|
||
/** | ||
* If you also require the length (number of bytes) that were required to decode the integer you can access it via `varint.decode.bytes`. | ||
* This is an integer property that will tell you the number of bytes that the last .decode() call had to use to decode. | ||
*/ | ||
bytes: number | ||
} | ||
|
||
/** | ||
* returns the number of bytes this number will be encoded as, up to a maximum of 8. | ||
*/ | ||
export function encodingLength (num: number): number |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters