MCPcopy Index your code
hub / github.com/hydro-dev/Hydro / parseMemoryMB

Function parseMemoryMB

framework/utils/lib/common.ts:162–168  ·  view source on GitHub ↗
(str: string | number, throwOnError = true)

Source from the content-addressed store, hash-verified

160}
161
162export function parseMemoryMB(str: string | number, throwOnError = true) {
163 if (typeof str === 'number' || Number.isSafeInteger(+str)) return +str;
164 const match = MEMORY_RE.exec(str);
165 if (!match && throwOnError) throw new Error(`${str} error parsing memory`);
166 if (!match) return 256;
167 return Math.ceil(Number.parseFloat(match[1]) * MEMORY_UNITS[match[2].toLowerCase()]);
168}
169
170function _digit2(number: number) {
171 return number < 10 ? `0${number}` : number.toString();

Callers 15

reducerFunction · 0.90
SubtaskSettingsFunction · 0.90
GlobalSettingsFunction · 0.90
parseConfigFunction · 0.90
procFunction · 0.90
adaptResultFunction · 0.90
runPipedFunction · 0.90
isValidConfigFunction · 0.90
runGeneratorFunction · 0.90
runStdFunction · 0.90
judgeCaseFunction · 0.90
judgeFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected