Open this example in the interactive library
Source code
import { parseArgs } from "node:util";
console.log(
parseArgs({
args: [],
options: { format: { type: "string", default: "json" } },
}).values,
);
Sample output
[Object: null prototype] { format: 'json' }