INNER CODE UNIT · TypeScript

readJson

x-cmd/x-cmd · mod/ajv/lib/ajv.ts:82

async function readJson<T = unknown>(p: string): Promise<T> {
    let text: string;
    try {
        text = await Deno.readTextFile(p);
    } catch (e) {
        throw new IoError(p, e);
    }
    return parseData(p, text) as T;
}

// Read a schema file.  Same error semantics as readJson.
async function readSchema(p: string): Promise<Record<string, unknown>> {
    let text: string;
    try {
        text = await Deno.readTextFile(p);
    } catch (e) {
        throw new IoError(p, e);
    }

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…