Dev Helpers
← Back

Provide a default option

Provide a default option using Node.js.

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' }