deno.land / x / lume@v2.1.4 / core / loaders / yaml.ts

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { parse } from "../../deps/yaml.ts";import { isPlainObject } from "../utils/object.ts";import { read } from "../utils/read.ts";
import type { RawData } from "../file.ts";
/** Load and parse a YAML file */export default async function yaml(path: string): Promise<RawData> { const text = await read(path, false); const content = parse(text);
if (!content) { return {}; }
if (isPlainObject(content)) { return content as RawData; }
return { content };}
lume

Version Info

Tagged at
7 months ago