js-yaml - v5.3.0
    Preparing search index...

    Function load

    • Parses string as a single YAML document. Throws YAMLException on error. This function does not understand multi-document or empty sources; it throws an exception on those.

      Note

      1. When processing untrusted input, see the security considerations.
      2. All exceptions MUST be caught, not just YAMLException.
      3. The default CORE_SCHEMA comes without the !!merge tag. You can easily enable it if needed.
      4. The default mapTag is {}-object based, with known limitations (see description). For full compatibility use realMapTag instead (it uses native JS Map).

      Parameters

      Returns unknown

      Enable mergeTag and realMapTag:

      import { load, CORE_SCHEMA, mergeTag, realMapTag } from 'js-yaml'

      try {
      load(data, { schema: CORE_SCHEMA.withTags(mergeTag, realMapTag) })
      } catch (e) {
      console.error(e)
      }