MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / convertMemoryToMB

Function convertMemoryToMB

vmm/ui/src/composables/useVmManager.ts:302–310  ·  view source on GitHub ↗
(value: number, unit: string)

Source from the content-addressed store, hash-verified

300 const BYTES_PER_MB = 1024 * 1024;
301
302 function convertMemoryToMB(value: number, unit: string) {
303 if (!Number.isFinite(value) || value < 0) {
304 return 0;
305 }
306 if (unit === 'GB') {
307 return value * 1024;
308 }
309 return value;
310 }
311
312 function convertSwapToBytes(value: number, unit: string) {
313 const mb = convertMemoryToMB(value, unit);

Callers 3

convertSwapToBytesFunction · 0.85
useVmManagerFunction · 0.85
createVmFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected