MCPcopy Create free account
hub / github.com/cortex-js/compute-engine / memToString

Function memToString

test/utils.ts:343–353  ·  view source on GitHub ↗
(n: number)

Source from the content-addressed store, hash-verified

341 if (errors && errors.length > 0) return formatError(errors);
342 return ['UnexpectedSuccess', strip(operands(value).length === 1 ? operand(value, 1)! : value) ?? 'Missing'];
343}
344
345function memToString(n: number): string {
346 if (n < 1024) return n.toFixed() + ' bytes';
347 n /= 1024;
348 if (n < 1024) return n.toFixed(1) + ' kB';
349 n /= 1024;
350 if (n < 1024) return n.toFixed(1) + ' MB';
351 n /= 1024;
352 if (n < 1024) return n.toFixed(1) + ' GB';
353 n /= 1024;
354 return n.toFixed(2) + ' TB';
355}
356

Callers 1

benchmarkFunction · 0.85

Calls 1

toFixedMethod · 0.80

Tested by

no test coverage detected