MCPcopy Create free account
hub / github.com/dailydotdev/apps / levelOf

Function levelOf

packages/webapp/components/world/ladder.ts:104–115  ·  view source on GitHub ↗
(articles: number)

Source from the content-addressed store, hash-verified

102 * plain scan over twelve entries rather than anything that allocates.
103 */
104export function levelOf(articles: number): number {
105 if (articles <= 0) {
106 return 0;
107 }
108 let level = 1;
109 for (let i = 0; i < LEVELS.length; i += 1) {
110 if (articles >= LEVELS[i].reads) {
111 level = i + 1;
112 }
113 }
114 return level;
115}
116
117/** The minimum a district needs to sit on `level`, and 0 for untouched ground. */
118export const floorOf = (level: number): number =>

Callers 15

WorldGuideContentFunction · 0.90
useWorldLogFunction · 0.90
ladder.spec.tsFile · 0.90
realmLevelOfFunction · 0.70
levelProgressFunction · 0.70
layoutFunction · 0.50
realmSigKeyFunction · 0.50
raiseRealmFunction · 0.50
enterRealmFunction · 0.50
updateHudFunction · 0.50
renderRankFunction · 0.50
placeStandardFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected