From f921993cd8e8c03c181a082816235ae4c9dbafe3 Mon Sep 17 00:00:00 2001 From: Rod Vagg Date: Tue, 3 Oct 2023 11:32:43 +1100 Subject: [PATCH] fix: switch interface method decl style --- src/api.ts | 30 +++++++++++++++--------------- src/coding.ts | 26 +++++++++++++------------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/api.ts b/src/api.ts index fe0c532..ceb0e38 100644 --- a/src/api.ts +++ b/src/api.ts @@ -26,12 +26,12 @@ export interface BlockIndex extends BlockHeader { export interface RootsReader { version: number - getRoots: () => Promise + getRoots(): Promise } export interface RootsBufferReader { version: number - getRoots: () => CID[] + getRoots(): CID[] } export interface BlockIterator extends AsyncIterable {} @@ -39,28 +39,28 @@ export interface BlockIterator extends AsyncIterable {} export interface CIDIterator extends AsyncIterable {} export interface BlockReader { - has: (key: CID) => Promise - get: (key: CID) => Promise - blocks: () => BlockIterator - cids: () => CIDIterator + has(key: CID): Promise + get(key: CID): Promise + blocks(): BlockIterator + cids(): CIDIterator } export interface BlockBufferReader { - has: (key: CID) => boolean - get: (key: CID) => Block | undefined - blocks: () => Iterable - cids: () => Iterable + has(key: CID): boolean + get(key: CID): Block | undefined + blocks(): Iterable + cids(): Iterable } export interface BlockWriter { - put: (block: Block) => Promise - close: () => Promise + put(block: Block): Promise + close(): Promise } export interface CarBufferWriter { - addRoot: (root: CID, options?: { resize?: boolean }) => CarBufferWriter - write: (block: Block) => CarBufferWriter - close: (options?: { resize?: boolean }) => Uint8Array + addRoot(root: CID, options?: { resize?: boolean }): CarBufferWriter + write(block: Block): CarBufferWriter + close(options?: { resize?: boolean }): Uint8Array } export interface CarBufferWriterOptions { diff --git a/src/coding.ts b/src/coding.ts index b7b9500..7b5ade3 100644 --- a/src/coding.ts +++ b/src/coding.ts @@ -2,16 +2,16 @@ import type { Block, BlockIndex } from './api.js' import type { CID } from 'multiformats/cid' export interface CarEncoder { - setRoots: (roots: CID[]) => Promise + setRoots(roots: CID[]): Promise - writeBlock: (block: Block) => Promise + writeBlock(block: Block): Promise - close: () => Promise + close(): Promise } export interface IteratorChannel_Writer { - write: (chunk: T) => Promise - end: () => Promise + write(chunk: T): Promise + end(): Promise } export interface IteratorChannel { @@ -38,29 +38,29 @@ export interface CarV2Header extends CarV2FixedHeader { } export interface CarDecoder { - header: () => Promise + header(): Promise - blocks: () => AsyncGenerator + blocks(): AsyncGenerator - blocksIndex: () => AsyncGenerator + blocksIndex(): AsyncGenerator } export interface Seekable { - seek: (length: number) => void + seek(length: number): void } export interface BytesReader extends Seekable { - upTo: (length: number) => Promise + upTo(length: number): Promise - exactly: (length: number, seek?: boolean) => Promise + exactly(length: number, seek?: boolean): Promise pos: number } export interface BytesBufferReader extends Seekable { - upTo: (length: number) => Uint8Array + upTo(length: number): Uint8Array - exactly: (length: number, seek?: boolean) => Uint8Array + exactly(length: number, seek?: boolean): Uint8Array pos: number }