File tree Expand file tree Collapse file tree 2 files changed +7
-6
lines changed
src/generators/legacy-json Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ export default {
6767 if ( output ) {
6868 await writeFile (
6969 join ( output , `${ node . api } .json` ) ,
70- JSON . stringify ( section )
70+ JSON . stringify ( section , null , 2 )
7171 ) ;
7272 }
7373 } )
Original file line number Diff line number Diff line change 1+ // @ts -check
12import { buildHierarchy } from './buildHierarchy.mjs' ;
23import { parseList } from './parseList.mjs' ;
34import { enforceArray } from '../../../utils/array.mjs' ;
@@ -116,11 +117,11 @@ export const createSectionBuilder = () => {
116117 // Only promote certain keys
117118 if ( ! UNPROMOTED_KEYS . includes ( key ) ) {
118119 // Merge the section's properties into the parent section
119- parent [ key ] = parent [ key ]
120- ? // If the parent already has this key, concatenate the values
121- [ ] . concat ( parent [ key ] , value )
122- : // Otherwise, directly assign the section's value to the parent
123- [ ] ;
120+ if ( parent [ key ] && Array . isArray ( parent [ key ] ) ) {
121+ parent [ key ] = parent [ key ] . concat ( value ) ;
122+ } else {
123+ parent [ key ] ||= value ;
124+ }
124125 }
125126 } ) ;
126127 }
You can’t perform that action at this time.
0 commit comments