MCPcopy Create free account
hub / github.com/denoland/std / parse

Function parse

yaml/parse.ts:74–87  ·  view source on GitHub ↗
(
  content: string,
  options: ParseOptions = {},
)

Source from the content-addressed store, hash-verified

72 * @returns Parsed document.
73 */
74export function parse(
75 content: string,
76 options: ParseOptions = {},
77): unknown {
78 content = sanitizeInput(content);
79 const state = new LoaderState(content, {
80 ...options,
81 schema: SCHEMA_MAP.get(options.schema!)!,
82 });
83 const documents = state.readDocuments({ singleDocument: true });
84 const document = documents.next().value;
85 documents.next();
86 return document ?? null;
87}
88
89/**
90 * Same as {@linkcode parse}, but understands multi-document YAML sources, and

Callers 2

fnFunction · 0.90
parse_test.tsFile · 0.90

Calls 4

readDocumentsMethod · 0.95
sanitizeInputFunction · 0.70
getMethod · 0.65
nextMethod · 0.45

Tested by

no test coverage detected