UNPKG

dev-lamp

Version:

Your friendly lighthouse performance companion - 100% local

37 lines 1.01 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.BaseFormatter = void 0; class BaseFormatter { getScoreEmoji(score) { if (score >= 90) return '[GOOD]'; if (score >= 50) return '[OK]'; return '[POOR]'; } getScoreLabel(score) { if (score >= 90) return 'Good'; if (score >= 50) return 'Needs Improvement'; return 'Poor'; } formatMs(ms) { if (ms < 1000) { return `${Math.round(ms)}ms`; } return `${(ms / 1000).toFixed(1)}s`; } formatBytes(bytes) { const units = ['B', 'KB', 'MB', 'GB']; let size = bytes; let unitIndex = 0; while (size >= 1024 && unitIndex < units.length - 1) { size /= 1024; unitIndex++; } return `${size.toFixed(1)} ${units[unitIndex]}`; } } exports.BaseFormatter = BaseFormatter; //# sourceMappingURL=base.formatter.js.map