MCPcopy Create free account
hub / github.com/NativeScript/SimDeck / parseArgs

Function parseArgs

scripts/stress/simdeck.mjs:237–255  ·  view source on GitHub ↗
(values)

Source from the content-addressed store, hash-verified

235}
236
237function parseArgs(values) {
238 const parsed = {};
239 for (let index = 0; index < values.length; index += 1) {
240 const value = values[index];
241 if (!value.startsWith("--")) {
242 continue;
243 }
244 const [rawKey, inlineValue] = value.slice(2).split("=", 2);
245 if (inlineValue != null) {
246 parsed[rawKey] = inlineValue;
247 } else if (values[index + 1] && !values[index + 1].startsWith("--")) {
248 parsed[rawKey] = values[index + 1];
249 index += 1;
250 } else {
251 parsed[rawKey] = "true";
252 }
253 }
254 return parsed;
255}
256
257function positiveInt(value, fallback) {
258 const parsed = optionalInt(value);

Callers 2

simdeck.mjsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected