@@ -81,6 +81,7 @@ export function supportsDNR() {
81
81
* @typedef {Object } SiteListUnpackOptions
82
82
* @property {boolean } [withSpacers=false] Whether spacers should be included.
83
83
* @property {boolean } [withVirtuals=false] Whether derived records should be included.
84
+ * @property {boolean } [compacted=true]
84
85
*/
85
86
86
87
@@ -109,7 +110,12 @@ function _unpackSiteArray( entities, options ) {
109
110
110
111
// Recurse if an array, or append
111
112
if ( Array . isArray ( entity ) ) {
112
- out = out . concat ( _unpackSiteArray ( entity , options ) ) ;
113
+ const unpacked = _unpackSiteArray ( entity , options ) ;
114
+ if ( options . compacted ?? true ) {
115
+ out = out . concat ( unpacked ) ;
116
+ } else {
117
+ out . push ( unpacked ) ;
118
+ }
113
119
} else {
114
120
out . push ( entity ) ;
115
121
}
@@ -127,12 +133,14 @@ function _unpackSiteArray( entities, options ) {
127
133
* @public
128
134
* @param {boolean } [withSpacers=false]
129
135
* @param {boolean } [withVirtuals=false]
136
+ * @param {boolean } [compacted=true]
130
137
* @return {SiteListEntity[] }
131
138
*/
132
- export function getWikis ( withSpacers , withVirtuals ) {
139
+ export function getWikis ( withSpacers , withVirtuals , compacted ) {
133
140
const out = _unpackSiteArray ( sites , {
134
141
withSpacers,
135
- withVirtuals
142
+ withVirtuals,
143
+ compacted
136
144
} ) ;
137
145
138
146
if ( withVirtuals ) {
0 commit comments