We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f085fbe commit 34acd70Copy full SHA for 34acd70
lib/compact.js
@@ -385,8 +385,10 @@ api.compact = ({
385
nestResult, itemActiveProperty, compactedItem,
386
{propertyIsArray: (!options.compactArrays || container.includes('@set'))});
387
} else {
388
- // wrap using @graph alias, remove array if only one item
389
- if(_isArray(compactedItem) && compactedItem.length === 1) {
+ // wrap using @graph alias, remove array if only one item and
+ // compactArrays not set
390
+ if(_isArray(compactedItem) && compactedItem.length === 1 &&
391
+ options.compactArrays) {
392
compactedItem = compactedItem[0];
393
}
394
compactedItem = {
0 commit comments