MCPcopy Create free account
hub / github.com/cameri/nostream / parseIntegerEnv

Function parseIntegerEnv

src/utils/compression.ts:37–51  ·  view source on GitHub ↗
(
  key: string,
  env: Environment,
)

Source from the content-addressed store, hash-verified

35}
36
37const parseIntegerEnv = (
38 key: string,
39 env: Environment,
40): number | undefined => {
41 const rawValue = env[key]
42 if (!rawValue || rawValue.trim() === '') {
43 return undefined
44 }
45
46 if (!/^-?\d+$/.test(rawValue.trim())) {
47 throw new Error(`Invalid ${key}: ${rawValue}. Expected an integer.`)
48 }
49
50 return Number(rawValue)
51}
52
53export const getXzCompressionOptions = (
54 cpuCount: number,

Callers 1

getXzCompressionOptionsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected