Skip to content

Commit

Permalink
chore: update output command
Browse files Browse the repository at this point in the history
  • Loading branch information
gentlementlegen committed Apr 3, 2024
1 parent eb309ac commit bc844e7
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions src/parser/processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,24 @@ export class Processor {

dump() {
const { file } = program.opts();
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;
});
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 bc844e7

Please sign in to comment.