UNPKG

mira-consciousness

Version:

Memory & Intelligence Retention Archive - Preserving The Spark

50 lines 1.65 kB
import chalk from 'chalk'; export function formatCodeQuality(score) { if (score >= 80) return chalk.green(`${score.toFixed(1)}/100 (Excellent)`); if (score >= 60) return chalk.yellow(`${score.toFixed(1)}/100 (Good)`); if (score >= 40) return chalk.yellow(`${score.toFixed(1)}/100 (Fair)`); return chalk.red(`${score.toFixed(1)}/100 (Poor)`); } export function formatComplexity(score) { if (score <= 10) return chalk.green(`${score.toFixed(1)} (Low)`); if (score <= 30) return chalk.yellow(`${score.toFixed(1)} (Moderate)`); if (score <= 50) return chalk.yellow(`${score.toFixed(1)} (High)`); return chalk.red(`${score.toFixed(1)} (Very High)`); } export function formatFileSize(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(2)} ${units[unitIndex]}`; } export function formatDuration(ms) { if (ms < 1000) return `${ms}ms`; if (ms < 60000) return `${(ms / 1000).toFixed(1)}s`; return `${(ms / 60000).toFixed(1)}m`; } export function formatMemoryUsage(mb) { if (mb < 100) return chalk.green(`${mb.toFixed(1)} MB`); if (mb < 500) return chalk.yellow(`${mb.toFixed(1)} MB`); return chalk.red(`${mb.toFixed(1)} MB`); } export function formatPercentage(value, total) { if (total === 0) return '0%'; const percentage = (value / total) * 100; return `${percentage.toFixed(1)}%`; } //# sourceMappingURL=formatting.js.map