Skip to content

Commit 5d084b4

Browse files
committed
code review
Signed-off-by: flakey5 <[email protected]>
1 parent 5a61eb7 commit 5d084b4

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

src/generators/legacy-json-all/index.mjs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,17 @@ export default {
3030
methods: [],
3131
};
3232

33+
const propertiesToCopy = [
34+
'miscs',
35+
'modules',
36+
'classes',
37+
'globals',
38+
'methods',
39+
];
40+
3341
for (const section of input) {
3442
// Copy the relevant properties from each section into our output
35-
for (const property of [
36-
'miscs',
37-
'modules',
38-
'classes',
39-
'globals',
40-
'methods',
41-
]) {
43+
for (const property of propertiesToCopy) {
4244
if (section[property]) {
4345
generatedValue[property].push(...section[property]);
4446
}

src/generators/legacy-json/utils/buildHierarchy.mjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ export function buildHierarchy(entries) {
4141

4242
previousEntry.hierarchyChildren.push(entry);
4343
} else {
44+
if (i < 2) {
45+
throw new Error(`can't find parent since i < 2 (${i})`);
46+
}
47+
4448
// Loop to find the entry we're a child of
4549
for (let j = i - 2; j >= 0; j--) {
4650
const jEntry = entries[j];

0 commit comments

Comments
 (0)