pkgjs / parseargs

Polyfill of `util.parseArgs()`
Apache License 2.0
121 stars 9 forks source link

parseArgs in non-Node.js runtimes #152

Open shadowspawn opened 5 months ago

shadowspawn commented 5 months ago

Fun to see parseArgs appearing in other runtimes as they expand node compatibility.

// parseargs.ts
import { parseArgs } from 'node:util';
console.log(parseArgs({ strict: false }));
% bun run parseargs.ts --beep first second
{
  values: {
    beep: true,
  },
  positionals: [ "first", "second" ],
}
% deno run parseargs.ts --beep first second
{
  values: [Object: null prototype] { beep: true },
  positionals: [ "first", "second" ]
}