MCPcopy Create free account
hub / github.com/dethcrypto/dethcode / readArg

Function readArg

packages/entrypoint/scripts/argv.js:15–31  ·  view source on GitHub ↗

* @param {string} name

(name)

Source from the content-addressed store, hash-verified

13 * @param {string} name
14 */
15function readArg(name) {
16 if (process.argv.includes(`--${name}`)) return true;
17
18 const argWithValuePrefix = `--${name}=`;
19 const withValue = process.argv.find((arg) =>
20 arg.startsWith(argWithValuePrefix)
21 );
22
23 if (withValue) {
24 return withValue.replace(argWithValuePrefix, "");
25 }
26
27 const fromEnv = process.env[name.toUpperCase()];
28 if (fromEnv) return fromEnv;
29
30 return false;
31}

Callers 1

argv.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected