Skip to main content
Module

x/lume/core/loaders/yaml.ts

πŸ”₯ Static site generator for Deno πŸ¦•
Very Popular
Go to Latest
File
import { parse } from "../../deps/yaml.ts";import { isPlainObject, read } from "../utils.ts";
import type { Data } from "../../core.ts";
/** Load and parse a YAML file */export default async function yaml(path: string): Promise<Data> { const text = await read(path, false); const content = parse(text);
if (!content) { return {}; }
if (isPlainObject(content)) { return content as Data; }
return { content };}