Skip to content
This repository was archived by the owner on Sep 3, 2021. It is now read-only.

Commit 29e2def

Browse files
carsonfarmervmx
authored andcommitted
fix: address review requests + ordering
Signed-off-by: Carson Farmer <[email protected]>
1 parent 5aff196 commit 29e2def

File tree

1 file changed

+34
-28
lines changed

1 file changed

+34
-28
lines changed

src/index.d.ts

Lines changed: 34 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -28,85 +28,91 @@ declare class CID {
2828
* new CID(<bs58 encoded multihash>)
2929
* new CID(<cid>)
3030
*/
31-
constructor(version: 0 | 1, codec: string, multhash: Buffer, multibaseName?: string)
32-
constructor(cidStr: string)
33-
constructor(cidBuf: Buffer)
34-
constructor(cidMultihash: Buffer)
35-
constructor(cid: CID)
36-
31+
constructor(
32+
version: 0 | 1,
33+
codec: string,
34+
multhash: Buffer,
35+
multibaseName?: string
36+
);
37+
constructor(cid: CID);
38+
constructor(str: string);
39+
constructor(buf: Buffer);
40+
41+
/**
42+
* The version of the CID.
43+
*/
44+
version: number;
45+
3746
/**
3847
* The codec of the CID.
3948
*/
40-
codec: string
49+
codec: string;
4150

4251
/**
4352
* The multihash of the CID.
4453
*/
45-
multihash: Buffer
54+
multihash: Buffer;
4655

4756
/**
4857
* Multibase name as string.
4958
*/
50-
multibaseName: string
59+
multibaseName: string;
5160

5261
/**
5362
* The CID as a `Buffer`
5463
*/
55-
readonly buffer: Buffer
56-
57-
/**
58-
* The prefix of the CID.
59-
*/
60-
readonly prefix: Buffer
64+
readonly buffer: Buffer;
6165

6266
/**
63-
* The version of the CID.
67+
* The prefix of the CID.
6468
*/
65-
version: number
69+
readonly prefix: Buffer;
6670

6771
/**
6872
* Convert to a CID of version `0`.
6973
*/
70-
toV0(): CID
74+
toV0(): CID;
7175

7276
/**
7377
* Convert to a CID of version `1`.
7478
*/
75-
toV1(): CID
79+
toV1(): CID;
80+
7681
/**
7782
* Encode the CID into a string.
7883
*
7984
* @param base Base encoding to use.
8085
*/
81-
toBaseEncodedString(base?: string): string
86+
toBaseEncodedString(base?: string): string;
8287

8388
/**
8489
* Encode the CID into a string.
8590
*/
86-
toString(base?: string): string
91+
toString(base?: string): string;
8792

8893
/**
8994
* Serialize to a plain object.
9095
*/
91-
toJSON(): { codec: string, version: 0 | 1, hash: Buffer }
92-
96+
toJSON(): { codec: string; version: 0 | 1; hash: Buffer };
97+
9398
/**
9499
* Compare equality with another CID.
95100
*
96101
* @param other The other CID.
97102
*/
98-
equals(other: any): boolean
99-
100-
static codecs: Record<string, Buffer>
101-
static isCID(mixed: any): boolean
103+
equals(other: any): boolean;
102104

103105
/**
104106
* Test if the given input is a valid CID object.
105107
* Throws if it is not.
106108
*
107109
* @param other The other CID.
108110
*/
109-
static validateCID(other: any): void
111+
static validateCID(other: any): void;
112+
113+
static isCID(mixed: any): boolean;
114+
115+
static codecs: Record<string, number>;
110116
}
111117

112118
export = CID

0 commit comments

Comments
 (0)