refactor: code cleanup
This commit is contained in:
parent
26bc187113
commit
a6c66e3278
2 changed files with 7 additions and 4 deletions
|
@ -34,7 +34,8 @@ export function handler(argv: any)
|
||||||
if (argv.output === "-")
|
if (argv.output === "-")
|
||||||
{
|
{
|
||||||
console.log(output);
|
console.log(output);
|
||||||
} else {
|
} else
|
||||||
|
{
|
||||||
fs.writeFileSync(argv.output, Buffer.from(output, "utf-8"));
|
fs.writeFileSync(argv.output, Buffer.from(output, "utf-8"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,10 +62,11 @@ export function handler(argv: any)
|
||||||
} else if (argv.content !== "__content")
|
} else if (argv.content !== "__content")
|
||||||
{
|
{
|
||||||
// Rename the content property.
|
// Rename the content property.
|
||||||
data.forEach(x => {
|
data.forEach(x =>
|
||||||
|
{
|
||||||
x[argv.content] = x.__content;
|
x[argv.content] = x.__content;
|
||||||
delete x.__content;
|
delete x.__content;
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Determine if we are displaying a list of items. If we want a list, then
|
// Determine if we are displaying a list of items. If we want a list, then
|
||||||
|
@ -84,7 +85,8 @@ export function handler(argv: any)
|
||||||
if (argv.output === "-")
|
if (argv.output === "-")
|
||||||
{
|
{
|
||||||
console.log(output);
|
console.log(output);
|
||||||
} else {
|
} else
|
||||||
|
{
|
||||||
fs.writeFileSync(argv.output, Buffer.from(output, "utf-8"));
|
fs.writeFileSync(argv.output, Buffer.from(output, "utf-8"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue