MCPcopy Create free account
hub / github.com/f0rr0/oliphaunt / parseArgs

Function parseArgs

scripts/perf/node-bench/start_nodefs_socket.mjs:10–26  ·  view source on GitHub ↗
(argv)

Source from the content-addressed store, hash-verified

8import { PGLiteSocketServer } from '@electric-sql/pglite-socket'
9
10function parseArgs(argv) {
11 const args = {}
12 for (let index = 0; index < argv.length; index += 1) {
13 const key = argv[index]
14 if (!key.startsWith('--')) {
15 continue
16 }
17 const value = argv[index + 1]
18 if (value && !value.startsWith('--')) {
19 args[key] = value
20 index += 1
21 } else {
22 args[key] = 'true'
23 }
24 }
25 return args
26}
27
28function requireArg(args, key) {
29 const value = args[key]

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected