generated from tpl/purs
fix: omit empty arrays and objects too
This commit is contained in:
parent
fe1bcc1989
commit
6e17bd3004
@ -16,11 +16,12 @@ export function toYAMLImpl(a) {
|
||||
const replacer = (_, o) => {
|
||||
if (typeof o === 'object') {
|
||||
Object.entries(o).forEach(([k, v]) => {
|
||||
if (typeof v === 'undefined' || v === null) {
|
||||
if (typeof v === 'undefined' || v === null || (v instanceof Array && v.length === 0) || (typeof v === 'object' && Object.keys(v).length === 0)) {
|
||||
delete o[k]
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user