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

Commit

Permalink
fix: address review requests + ordering
Browse files Browse the repository at this point in the history
Signed-off-by: Carson Farmer <[email protected]>
  • Loading branch information
carsonfarmer authored and vmx committed Jan 24, 2020
1 parent 5aff196 commit 29e2def
Showing 1 changed file with 34 additions and 28 deletions.
62 changes: 34 additions & 28 deletions src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,85 +28,91 @@ declare class CID {
* new CID(<bs58 encoded multihash>)
* new CID(<cid>)
*/
constructor(version: 0 | 1, codec: string, multhash: Buffer, multibaseName?: string)
constructor(cidStr: string)
constructor(cidBuf: Buffer)
constructor(cidMultihash: Buffer)
constructor(cid: CID)

constructor(
version: 0 | 1,
codec: string,
multhash: Buffer,
multibaseName?: string
);
constructor(cid: CID);
constructor(str: string);
constructor(buf: Buffer);

/**
* The version of the CID.
*/
version: number;

/**
* The codec of the CID.
*/
codec: string
codec: string;

/**
* The multihash of the CID.
*/
multihash: Buffer
multihash: Buffer;

/**
* Multibase name as string.
*/
multibaseName: string
multibaseName: string;

/**
* The CID as a `Buffer`
*/
readonly buffer: Buffer

/**
* The prefix of the CID.
*/
readonly prefix: Buffer
readonly buffer: Buffer;

/**
* The version of the CID.
* The prefix of the CID.
*/
version: number
readonly prefix: Buffer;

/**
* Convert to a CID of version `0`.
*/
toV0(): CID
toV0(): CID;

/**
* Convert to a CID of version `1`.
*/
toV1(): CID
toV1(): CID;

/**
* Encode the CID into a string.
*
* @param base Base encoding to use.
*/
toBaseEncodedString(base?: string): string
toBaseEncodedString(base?: string): string;

/**
* Encode the CID into a string.
*/
toString(base?: string): string
toString(base?: string): string;

/**
* Serialize to a plain object.
*/
toJSON(): { codec: string, version: 0 | 1, hash: Buffer }
toJSON(): { codec: string; version: 0 | 1; hash: Buffer };

/**
* Compare equality with another CID.
*
* @param other The other CID.
*/
equals(other: any): boolean

static codecs: Record<string, Buffer>
static isCID(mixed: any): boolean
equals(other: any): boolean;

/**
* Test if the given input is a valid CID object.
* Throws if it is not.
*
* @param other The other CID.
*/
static validateCID(other: any): void
static validateCID(other: any): void;

static isCID(mixed: any): boolean;

static codecs: Record<string, number>;
}

export = CID

0 comments on commit 29e2def

Please sign in to comment.