mirror of
https://github.com/farcasterxyz/hub-monorepo.git
synced 2026-01-28 14:38:00 -05:00
* chore: add rome config files * chore: add rome into configs and ci * chore: remove eslint annotations * chore: update annotations for rome ignores * chore: remove prettier
23 lines
1013 B
TypeScript
23 lines
1013 B
TypeScript
import { fromFarcasterTime } from "@farcaster/hub-nodejs";
|
|
|
|
export function farcasterTimeToDate(time: undefined): undefined;
|
|
export function farcasterTimeToDate(time: null): null;
|
|
export function farcasterTimeToDate(time: number): Date;
|
|
export function farcasterTimeToDate(time: number | null | undefined): Date | null | undefined;
|
|
export function farcasterTimeToDate(time: number | null | undefined): Date | null | undefined {
|
|
if (time === undefined) return undefined;
|
|
if (time === null) return null;
|
|
const result = fromFarcasterTime(time);
|
|
if (result.isErr()) throw result.error;
|
|
return new Date(result.value);
|
|
}
|
|
|
|
export function bytesToHex(bytes: undefined): undefined;
|
|
export function bytesToHex(bytes: null): null;
|
|
export function bytesToHex(bytes: Uint8Array): string;
|
|
export function bytesToHex(bytes: Uint8Array | null | undefined): string | null | undefined {
|
|
if (bytes === undefined) return undefined;
|
|
if (bytes === null) return null;
|
|
return `0x${Buffer.from(bytes).toString("hex")}`;
|
|
}
|