MCPcopy Create free account
hub / github.com/ReactTooltip/react-tooltip / readPortValue

Function readPortValue

scripts/dev-port.mjs:3–15  ·  view source on GitHub ↗
(args, index, prefix)

Source from the content-addressed store, hash-verified

1const DEFAULT_PORT = 3000
2
3function readPortValue(args, index, prefix) {
4 const arg = args[index]
5
6 if (arg.includes('=')) {
7 return arg.split('=')[1]
8 }
9
10 if (arg.startsWith(prefix) && arg.length > prefix.length) {
11 return arg.slice(prefix.length)
12 }
13
14 return args[index + 1]
15}
16
17function parsePort(args = process.argv.slice(2), defaultPort = DEFAULT_PORT) {
18 for (let index = 0; index < args.length; index += 1) {

Callers 1

parsePortFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected