MCPcopy Create free account
hub / github.com/ACM-VIT/conclave / integerEnv

Function integerEnv

scripts/loadtest/loadtest.mjs:4–15  ·  view source on GitHub ↗
(name, fallback, { min = 0, max = Number.MAX_SAFE_INTEGER } = {})

Source from the content-addressed store, hash-verified

2import { io } from "socket.io-client";
3
4const integerEnv = (name, fallback, { min = 0, max = Number.MAX_SAFE_INTEGER } = {}) => {
5 const raw = process.env[name];
6 if (raw == null || raw.trim() === "") return fallback;
7
8 const value = Number(raw);
9 if (!Number.isInteger(value) || value < min || value > max) {
10 console.warn(`[config] ignoring invalid ${name}=${JSON.stringify(raw)}; using ${fallback}`);
11 return fallback;
12 }
13
14 return value;
15};
16
17const booleanEnv = (name, fallback) => {
18 const raw = process.env[name];

Callers 1

loadtest.mjsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected