-
Notifications
You must be signed in to change notification settings - Fork 26
fix: filter out new keys from legacy JSON generator #595
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
aefa413
704b728
bb9559a
b69ded0
7078901
7da8299
488a2a3
a8e1af5
c231947
870043b
236c8b0
632755b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -109,3 +109,63 @@ export const sortChanges = (changes, key = 'version') => { | |
| */ | ||
| export const leftHandAssign = (target, source) => | ||
| Object.keys(source).forEach(k => k in target || (target[k] = source[k])); | ||
|
|
||
| /** | ||
| * Transforms an object to JSON output consistent with the JSON version. | ||
| * @param {Object} section - The source object | ||
| * @param section.api | ||
| * @param section.type | ||
| * @param section.source | ||
| * @param section.introduced_in | ||
| * @param section.meta | ||
| * @param section.stability | ||
| * @param section.stabilityText | ||
| * @param section.classes | ||
| * @param section.methods | ||
| * @param section.properties | ||
| * @param section.miscs | ||
| * @param section.modules | ||
| * @param section.globals | ||
| * @returns {string} - The JSON output | ||
| */ | ||
| export const legacyToJSON = ({ | ||
| api, | ||
| type, | ||
| source, | ||
| introduced_in, | ||
| meta, | ||
| stability, | ||
| stabilityText, | ||
| classes, | ||
| methods, | ||
| properties, | ||
| miscs, | ||
| modules, | ||
| globals, | ||
| }) => | ||
| JSON.stringify( | ||
| { | ||
| type, | ||
| source, | ||
| introduced_in, | ||
| ...(api === 'report' | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @aduh95 can you add inline comment explaining why this different order with api === report?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @aduh95 can you add inline comment explaining why this different order with api === report? |
||
| ? { | ||
| stability, | ||
| stabilityText, | ||
| meta, | ||
| } | ||
| : { | ||
| meta, | ||
| stability, | ||
| stabilityText, | ||
| }), | ||
| classes, | ||
| methods, | ||
| properties, | ||
| miscs, | ||
| ...(api === 'index' ? undefined : { modules }), | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @aduh95 can you add inline comment explaining why for api === index we gotta set nothing?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @aduh95 can you add inline comment explaining why for api === index we gotta set nothing?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @aduh95 can you add inline comment explaining why for api === index we gotta set nothing? |
||
| globals, | ||
| }, | ||
| null, | ||
| 2 | ||
| ); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aduh95 can you add inline comment explaining why this different order with api === report?