UNPKG

@hyperlane-xyz/utils

Version:

General utilities and types for the Hyperlane network

23 lines 1.05 kB
export type FileFormat = 'yaml' | 'json'; /** * Resolves the file format based on filepath extension or explicit format. */ export declare function resolveFileFormat(filepath?: string, format?: FileFormat): FileFormat | undefined; /** * Indents a multi-line string by the specified number of spaces. */ export declare function indentYamlOrJson(str: string, indentLevel: number): string; /** * Reads and parses a YAML or JSON file based on extension or explicit format. */ export declare function readYamlOrJson<T>(filepath: string, format?: FileFormat): T; /** * Writes a value as YAML or JSON based on extension or explicit format. */ export declare function writeYamlOrJson(filepath: string, obj: unknown, format?: FileFormat): void; /** * Merges an object with existing file content and writes the result. * Format is determined by extension or explicit format (defaults to yaml). */ export declare function mergeYamlOrJson(filepath: string, obj: Record<string, unknown>, format?: FileFormat): void; //# sourceMappingURL=format.d.ts.map