* Stars move constantly; rewriting 200 files because a project gained three * stars produces daily noise PRs that nobody reads. We round to the same * precision the hub already uses (3 significant digits) and only write when * that rounded value actually moves.
(stars: number)
| 111 | * that rounded value actually moves. |
| 112 | */ |
| 113 | function roundStars(stars: number): number { |
| 114 | if (stars < 1000) return Math.round(stars / 10) * 10; |
| 115 | const magnitude = 10 ** (Math.floor(Math.log10(stars)) - 2); |
| 116 | return Math.round(stars / magnitude) * magnitude; |
| 117 | } |
| 118 | |
| 119 | /** Trailing slashes and http:// are cosmetic differences, not real drift. */ |
| 120 | const canonical = (url: string) => |