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

Function formatOutput

src/helpers.js:450–471  ·  view source on GitHub ↗
(result, e, u, output, spacer)

Source from the content-addressed store, hash-verified

448 * @returns {string|Array|Object|number} Formatted result in requested type
449 */
450export function formatOutput(result, e, u, output, spacer) {
451 if (output === ARRAY) {
452 return result;
453 }
454
455 if (output === OBJECT) {
456 return {
457 value: result[0],
458 symbol: result[1],
459 exponent: e,
460 unit: u,
461 };
462 }
463
464 let formatted;
465 if (spacer === SPACE) {
466 formatted = `${result[0]} ${result[1]}`;
467 } else {
468 formatted = result.join(spacer);
469 }
470 return formatted;
471}

Callers 1

filesizeFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected