MCPcopy Create free account
hub / github.com/nodejs/nodejs.org / formatPercent

Function formatPercent

apps/site/scripts/compare-size/index.mjs:23–26  ·  view source on GitHub ↗
(oldValue, newValue)

Source from the content-addressed store, hash-verified

21 * @returns {string} Formatted percentage
22 */
23const formatPercent = (oldValue, newValue) => {
24 const percent = (((newValue - oldValue) / oldValue) * 100).toFixed(2);
25 return `${percent > 0 ? '+' : ''}${percent}%`;
26};
27
28/**
29 * Categorizes asset changes

Callers 1

reportDiffFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected