Auto-indexing service and GraphQL API for AT Protocol Records
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

chore: remove unused format.gleam

The format_number function was not imported or used anywhere in the codebase.

-42
-42
server/src/format.gleam
··· 1 - import gleam/int 2 - import gleam/list 3 - import gleam/string 4 - 5 - /// Formats an integer with comma thousand separators 6 - /// Example: format_number(1234567) -> "1,234,567" 7 - pub fn format_number(num: Int) -> String { 8 - let str = int.to_string(num) 9 - let is_negative = string.starts_with(str, "-") 10 - let digits = case is_negative { 11 - True -> string.drop_start(str, 1) 12 - False -> str 13 - } 14 - 15 - let chars = string.to_graphemes(digits) 16 - let char_count = list.length(chars) 17 - 18 - // If 3 or fewer digits, no commas needed 19 - case char_count <= 3 { 20 - True -> str 21 - False -> { 22 - let reversed = list.reverse(chars) 23 - 24 - let formatted = 25 - reversed 26 - |> list.index_map(fn(char, idx) { 27 - case idx > 0 && idx % 3 == 0 { 28 - True -> [",", char] 29 - False -> [char] 30 - } 31 - }) 32 - |> list.flatten 33 - |> list.reverse 34 - |> string.join("") 35 - 36 - case is_negative { 37 - True -> "-" <> formatted 38 - False -> formatted 39 - } 40 - } 41 - } 42 - }