Dev Helpers
← Back

Accumulate multiple values

Accumulate multiple values using Node.js.

Open this example in the interactive library

Source code

import { parseArgs } from "node:util";
console.log(
  parseArgs({
    args: ["--tag", "a", "--tag", "b"],
    options: { tag: { type: "string", multiple: true } },
  }).values,
);

Sample output

[Object: null prototype] { tag: [ 'a', 'b' ] }