|  | 
| 1 | 1 | import chalk from 'chalk'; | 
| 2 | 2 | 
 | 
|  | 3 | +const formatScore = (score) => { | 
|  | 4 | +  const roundedScore = Math.round(score * 100); | 
|  | 5 | + | 
|  | 6 | +  if (roundedScore === 100) { | 
|  | 7 | +    return '💯'; | 
|  | 8 | +  } else if (roundedScore > 90) { | 
|  | 9 | +    return `🥇  ${chalk.greenBright.bold(`(${roundedScore}/100)`)}`; | 
|  | 10 | +  } else if (roundedScore > 80) { | 
|  | 11 | +    return `🥈  ${chalk.green.bold(`(${roundedScore}/100)`)}`; | 
|  | 12 | +  } else if (roundedScore > 70) { | 
|  | 13 | +    return `🥉  ${chalk.magentaBright.bold(`(${roundedScore}/100)`)}`; | 
|  | 14 | +  } else if (roundedScore > 60) { | 
|  | 15 | +    return `😅  ${chalk.magenta.bold(`(${roundedScore}/100)`)}`; | 
|  | 16 | +  } else if (roundedScore > 50) { | 
|  | 17 | +    return `🤔  ${chalk.blue.bold(`(${roundedScore}/100)`)}`; | 
|  | 18 | +  } else if (roundedScore > 40) { | 
|  | 19 | +    return `😯  ${chalk.blueBright.bold(`(${roundedScore}/100)`)}`; | 
|  | 20 | +  } else if (roundedScore > 30) { | 
|  | 21 | +    return `🤞  ${chalk.yellow.bold(`(${roundedScore}/100)`)}`; | 
|  | 22 | +  } else if (roundedScore > 20) { | 
|  | 23 | +    return `😳  ${chalk.yellowBright.bold(`(${roundedScore}/100)`)}`; | 
|  | 24 | +  } else if (roundedScore > 10) { | 
|  | 25 | +    return `🙏 ${chalk.red.bold(`(${roundedScore}/100)`)}`; | 
|  | 26 | +  } else if (roundedScore > 0) { | 
|  | 27 | +    return `🥔  ${chalk.redBright.bold(`(${roundedScore}/100)`)}`; | 
|  | 28 | +  } | 
|  | 29 | + | 
|  | 30 | +  return ''; | 
|  | 31 | +}; | 
|  | 32 | + | 
| 3 | 33 | const formatPackageDetails = ({ | 
| 4 | 34 |   name, | 
| 5 | 35 |   version, | 
| 6 | 36 |   description, | 
| 7 | 37 |   author, | 
| 8 |  | -}) => `📦  ${chalk.green.bold(name)} | 📌  ${chalk.cyan.underline(version)} | 🏷️  ${chalk.yellow.bold(description)} | ⌨️  ${chalk.blueBright.underline(`@${author}`)}`; | 
|  | 38 | +  score, | 
|  | 39 | +}) => `📦  ${chalk.green.bold(name)} | 📌  ${chalk.cyan.underline(version)} | 🏷️  ${chalk.yellow.bold(description)} | ⌨️  ${chalk.blueBright.underline(`@${author}`)} | ${formatScore(score)}`; | 
| 9 | 40 | 
 | 
| 10 | 41 | export default formatPackageDetails; | 
0 commit comments