(
content: string,
options: ParseOptions = {},
)
| 59 | * @returns Parsed document. |
| 60 | */ |
| 61 | export function parse( |
| 62 | content: string, |
| 63 | options: ParseOptions = {}, |
| 64 | ): unknown { |
| 65 | content = sanitizeInput(content); |
| 66 | const state = new LoaderState(content, { |
| 67 | ...options, |
| 68 | schema: getSchema(options.schema, options.extraTypes), |
| 69 | }); |
| 70 | const documents = state.readDocuments({ singleDocument: true }); |
| 71 | const document = documents.next().value; |
| 72 | documents.next(); |
| 73 | return document ?? null; |
| 74 | } |
| 75 | |
| 76 | /** |
| 77 | * Same as {@linkcode parse}, but understands multi-document YAML sources, and |
nothing calls this directly
no test coverage detected