fix: omit nulls

This commit is contained in:
orion 2023-11-28 14:28:58 -06:00
parent dd513b1aac
commit fe1bcc1989
Signed by: orion
GPG Key ID: 6D4165AE4C928719

View File

@ -13,14 +13,15 @@ export function objToHash(valueToYAMLImpl, fst, snd, obj) {
}
export function toYAMLImpl(a) {
const replacer = (_, v) => {
if (typeof v === 'object') {
Object.keys(v).forEach(k => {
if (v[k] === null) {
delete v[k]
const replacer = (_, o) => {
if (typeof o === 'object') {
Object.entries(o).forEach(([k, v]) => {
if (typeof v === 'undefined' || v === null) {
delete o[k]
}
})
}
return o
}
return yaml.dump(a, { noCompatMode: true, replacer })