Dev Helpers
← Back

Accept a short alias

Accept a short alias using Node.js.

Open this example in the interactive library

Source code

import { parseArgs } from "node:util";
console.log(
  parseArgs({
    args: ["-v"],
    options: { verbose: { type: "boolean", short: "v" } },
  }).values,
);

Sample output

[Object: null prototype] { verbose: true }