{"id":16527177,"url":"https://github.com/zignis/abbrev-num","last_synced_at":"2025-03-03T05:12:06.402Z","repository":{"id":232031968,"uuid":"783277597","full_name":"zignis/abbrev-num","owner":"zignis","description":"Abbreviate numbers into a human-friendly format","archived":false,"fork":false,"pushed_at":"2024-04-07T15:14:23.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-28T16:34:53.152Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zignis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-04-07T12:52:27.000Z","updated_at":"2024-04-07T12:52:53.000Z","dependencies_parsed_at":"2024-04-07T15:27:45.034Z","dependency_job_id":null,"html_url":"https://github.com/zignis/abbrev-num","commit_stats":null,"previous_names":["zignis/abbrev-num"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zignis%2Fabbrev-num","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zignis%2Fabbrev-num/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zignis%2Fabbrev-num/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zignis%2Fabbrev-num/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zignis","download_url":"https://codeload.github.com/zignis/abbrev-num/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241610990,"owners_count":19990508,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-11T17:33:56.634Z","updated_at":"2025-03-03T05:12:06.385Z","avatar_url":"https://github.com/zignis.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# abbrev-num\n\nAbbreviate numbers into a human-friendly format\n\n# Examples\n\n## Basic\n\n```rust\nuse abbrev_num::abbrev_num;\n\nassert_eq!(abbrev_num(1_400, None), Some(\"1.4k\".to_string()));\n```\n\n## Precision\n\n```rust\nuse abbrev_num::{abbrev_num, Options};\n\nlet options = Options {\n    precision: Some(2),\n    ..Default::default()\n};\n\nassert_eq!(abbrev_num(1_420, Some(options)), Some(\"1.42k\".to_string()));\n```\n\n## Custom units\n\n```rust\nuse abbrev_num::{abbrev_num, Options};\n\nlet units: [\u0026str; 7] = [\"mm\", \"cm\", \"m\", \"km\", \"\", \"\", \"\"];\nlet options = Options {\n    abbreviations: Some(units),\n    ..Default::default()\n};\n\nassert_eq!(abbrev_num(1_400, Some(options)), Some(\"1.4cm\".to_string()));\n```\n\n## Custom rounding strategy\n\n```rust\nuse abbrev_num::{abbrev_num, Options, RoundingStrategy};\n\nlet options = Options {\n    rounding_strategy: Some(RoundingStrategy::ToZero),\n    precision: Some(0),\n    ..Default::default()\n};\n\nassert_eq!(abbrev_num(1_566_450, Some(options)), Some(\"1M\".to_string()));\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzignis%2Fabbrev-num","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzignis%2Fabbrev-num","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzignis%2Fabbrev-num/lists"}