(
content: string,
options: ParseOptions = {},
)
| 72 | * @returns Parsed document. |
| 73 | */ |
| 74 | export 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 |
no test coverage detected