Open peterbe opened 4 years ago
And, it should use yaml.safeDump
.
So, perhaps to be complete, this should work too:
const metadata = {match: "!!js/regexp /pattern/gim"}
const payload = "Hi there!"
const combined = fm.serialize(metadata, payload, {unsafe: true} ) // Or something
const parsed = fm(combined);
assert(JSON.stringify(parsed.attributes) === JSON.stringify(metadata))
assert(parsed.body === payload)
I'd love to be able to do
fm.serialize(attributes, body)
.This should work: