Skip to content

Commit

Permalink
chore: made type human-readable on dump
Browse files Browse the repository at this point in the history
  • Loading branch information
gentlementlegen authored and gentlementlegen committed Mar 23, 2024
1 parent e6809d7 commit e78b7c3
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/parser/processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,24 @@ export class Processor {

dump() {
const { file } = program.opts();
const result = JSON.stringify(this._result, undefined, 2);
const result = JSON.stringify(
this._result,
(key: string, value: string | number) => {
// Changes "type" to be human-readable
if (key === "type" && typeof value === "number") {
const typeNames: string[] = [];
const types = Object.values(CommentType) as number[];
types.forEach((typeValue) => {
if (value & typeValue) {
typeNames.push(CommentType[typeValue]);
}
});
return typeNames.join("|");
}
return value;
},
2
);
if (!file) {
console.log(result);
} else {
Expand Down

0 comments on commit e78b7c3

Please sign in to comment.