MCPcopy Create free account
hub / github.com/avoidwork/filesize.js / resolveSymbol

Function resolveSymbol

src/helpers.js:345–358  ·  view source on GitHub ↗
(actualStandard, bits, e, isDecimal)

Source from the content-addressed store, hash-verified

343 * @returns {string} The resolved unit symbol string
344 */
345export function resolveSymbol(actualStandard, bits, e, isDecimal) {
346 const symbolTable = STRINGS.symbol[actualStandard][bits ? BITS : BYTES];
347 let result;
348 if (isDecimal && e === 1) {
349 if (bits) {
350 result = SI_KBIT;
351 } else {
352 result = SI_KBYTE;
353 }
354 } else {
355 result = symbolTable[e];
356 }
357 return result;
358}
359
360/**
361 * Decorates the result: applies negation, custom symbols, number formatting, and full form names

Callers 1

filesizeFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected