File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -113,87 +113,51 @@ export const leftHandAssign = (target, source) =>
113113/**
114114 * Transforms an object to JSON output consistent with the JSON version.
115115 * @param {Object } section - The source object
116- * @param section.api
117- * @param section.type
118- * @param section.source
119- * @param section.introduced_in
120- * @param section.meta
121- * @param section.stability
122- * @param section.stabilityText
123- * @param section.classes
124- * @param section.methods
125- * @param section.properties
126- * @param section.miscs
127- * @param section.modules
128- * @param section.globals
129116 * @returns {string } - The JSON output
130117 */
131- export const legacyToJSON = ( {
132- api,
133- type,
134- source,
135- introduced_in,
136- meta,
137- stability,
138- stabilityText,
139- classes,
140- methods,
141- properties,
142- miscs,
143- modules,
144- globals,
145- } ) =>
118+ export const legacyToJSON = section =>
146119 JSON . stringify (
147- {
148- type,
149- source,
150- introduced_in,
151- meta,
152- stability,
153- stabilityText,
154- classes,
155- methods,
156- properties,
157- miscs,
158- modules,
159- globals,
160- } ,
120+ section ,
121+ // TODO: remove this array once all the additional keys have been introduced downstream
161122 [
162- // TODO: remove this array once all the additional keys have been introduced downstream
123+ // Top-level keys (order matter):
124+ 'type' ,
125+ 'source' ,
126+ 'introduced_in' ,
127+ 'meta' ,
128+ 'stability' ,
129+ 'stabilityText' ,
130+ 'classes' ,
131+ 'methods' ,
132+ 'properties' ,
133+ 'miscs' ,
134+ ...( section . api === 'index' ? [ ] : [ 'modules' ] ) ,
135+ 'globals' ,
136+
137+ // History section
163138 'added' ,
139+ 'deprecated' ,
140+ 'removed' ,
164141 'changes' ,
165- 'classes' ,
142+ // Remaining keys
166143 'classMethods' ,
167144 'commit' ,
168145 'ctors' ,
169146 'default' ,
170- 'deprecated' ,
171147 'desc' ,
172148 'description' ,
173149 'displayName' ,
174150 'events' ,
175151 'examples' ,
176- 'globals' ,
177- 'introduced_in' ,
178- 'meta' ,
179- 'methods' ,
180- 'miscs' ,
181- ...( api === 'index' ? [ ] : [ 'modules' ] ) ,
182152 'name' ,
183153 'napiVersion' ,
184154 'options' ,
185155 'params' ,
186156 'pr-url' ,
187- 'properties' ,
188- 'removed' ,
189157 'return' ,
190158 'shortDesc' ,
191159 'signatures' ,
192- 'source' ,
193- 'stability' ,
194- 'stabilityText' ,
195160 'textRaw' ,
196- 'type' ,
197161 'version' ,
198162 ] ,
199163 2
You can’t perform that action at this time.
0 commit comments