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