how to handle undefined values cleanly?

I'm dump ing an object, and fields without values come out like this:

fieldName: !<tag:yaml.org,2002:js/undefined> ''

how can I suppress that to either undefined or just to skip it like JSON.stringify ?

I tried some options from the safeDump

const blob = yaml.dump(obj, { skipInvalid: true, lineWidth: 200 })

https://github.com/nodeca/js-yaml#safedump-object---options-

but without success. I guess I can strip out the undefined fields, but I'd have to do a deep clean of the whole object... also check for false vs undefined etc. etc.

I tried this but it didn't have any effect:
const clean = { ...obj } // remove nulls?

Sure there must be a nicer way to handle this with js-yaml ?
Do I have to define my own schema?

related:
#456
https://stackoverflow.com/a/38340374/1146785

  async debugMessage(obj) {
    console.log('json', JSON.stringify(obj, null, 2))
    const blob = yaml.dump(obj)
    console.log('yaml', blob)
  }


// json 

{
  "msg": "router",
  "input": "sleep",
  "eventType": "action",
  "handled": {
    "handled": true,
    "doc": {
      "match": "^cont|.*",
      "goto": "prologue"
    },
    "klass": "room",
    "history": [
      "goto"
    ]
  }
}

// yaml 

msg: router
input: sleep
eventType: action
parsed: !<tag:yaml.org,2002:js/undefined> ''
handled:
  handled: true
  doc:
    match: ^cont|.*
    goto: prologue
  klass: room
  history:
    - goto