Skip to content

load

load(input, opts?): unknown

Defined in: src/js-yaml-compat.ts:296

NOTE: js-yaml v4’s load("") (and a few other near-empty inputs) returned undefined, quirkily — e.g. load(" ") and load("\n") were undefined too, but load(" \n \n") and load("# comment\n") were null. js-yaml v5 changed this again: load("") now THROWS a YAMLException (“an empty stream has no document, and load has no output value to signal its absence” — per the v5 migration guide), rather than returning anything. We always return null for an empty document, matching our own parse()’s documented contract, in BOTH cases — reproducing either v4’s quirk or v5’s new throw isn’t worth it for a compat shim. Tracked as a known, low-impact divergence (see bench/conformance/compat.ts).

string

LoadOptions

unknown