dangerfile.js
function addPercent(change, goodEmoji = '', badEmooji = ':small_red_triangle:') {
  const formatted = (change * 100).toFixed(2);
  if (/^-|^0(?:\.0+)$/.test(formatted)) {
    return `${formatted}% ${goodEmoji}`;
  }
  return `+${formatted}% ${badEmooji}`;
}
function addPercent(change, goodEmoji = '', badEmooji = ':small_red_triangle:') {
  const formatted = (change * 100).toFixed(2);
  if (/^-|^0(?:\.0+)$/.test(formatted)) {
    return `${formatted}% ${goodEmoji}`;
  }
  return `+${formatted}% ${badEmooji}`;
}
function addPercent ( change , goodEmoji = '' , badEmooji = ':small_red_triangle:' ) { const formatted = ( change * 100 ) . toFixed ( 2 ) ; if ( / ^-|^0(?:\.0+)$ / . test ( formatted ) ) { return ` ${ formatted } ${ goodEmoji } ` ; } return ` ${ formatted } ${ badEmooji } ` ; }
Generates a user-readable string from a percentage change
@param {number} change
@param {string} goodEmoji emoji on reduction
@param {string} badEmooji emoji on increase
Generates a user - readable string from a percentage change