I am using util.inspect to format a manipulated object before writing it back to a file. Recently I have introduced simple numeric arrays to this object and they are being formatted in an unexpected way. Here is what I want from my output (partial example):
app_preferred_items: [ 0, 6, 13, 16, 19, 23, 26 ],
main_set: [
{
name: 'item1',
show: true,
description: 'Item One',
id: 12,
version: 1
},
{
name: 'item2',
show: true,
description: 'Item Two',
id: 13,
version: 1
}
]
but here is what I am getting:
app_preferred_items: [
0, 6, 13, 16,
19, 23, 26
],
main_set: [
{
name: 'item1',
show: true,
description: 'Item One',
id: 12,
version: 1
},
{
name: 'item2',
show: true,
description: 'Item Two',
id: 13,
version: 1
}
]
I have tried various options from here but to no avail yet. I either get a single line for the entire file (using compact option) which makes readability difficult, or this simple number array breaking pattern which I don't want. Is there any way to make simple numeric arrays stay on one line?