{"id":43364487,"url":"https://github.com/sbani/go-humanizer","last_synced_at":"2026-02-02T04:39:58.570Z","repository":{"id":46267834,"uuid":"45347112","full_name":"sbani/go-humanizer","owner":"sbani","description":"Go library to humanize your input","archived":false,"fork":false,"pushed_at":"2023-02-14T08:33:21.000Z","size":45,"stargazers_count":16,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-06-18T23:17:35.901Z","etag":null,"topics":["golang","helper","humanizer","string-manipulation"],"latest_commit_sha":null,"homepage":"","language":"Go","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/sbani.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,"publiccode":null,"codemeta":null}},"created_at":"2015-11-01T16:04:36.000Z","updated_at":"2024-03-27T12:16:40.000Z","dependencies_parsed_at":"2024-06-18T23:00:58.508Z","dependency_job_id":"48b9cc6b-5b67-40fd-afe3-88e348880722","html_url":"https://github.com/sbani/go-humanizer","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/sbani/go-humanizer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbani%2Fgo-humanizer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbani%2Fgo-humanizer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbani%2Fgo-humanizer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbani%2Fgo-humanizer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sbani","download_url":"https://codeload.github.com/sbani/go-humanizer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbani%2Fgo-humanizer/sbom","scorecard":{"id":802477,"data":{"date":"2025-08-11","repo":{"name":"github.com/sbani/go-humanizer","commit":"3395eff8cb794dfbb77040da657aa1f0df39563e"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.4,"checks":[{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codecov.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/sbani/go-humanizer/codecov.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codecov.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/sbani/go-humanizer/codecov.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/codecov.yml:29: update your workflow using https://app.stepsecurity.io/secureworkflow/sbani/go-humanizer/codecov.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/sbani/go-humanizer/release.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/sbani/go-humanizer/release.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/sbani/go-humanizer/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/sbani/go-humanizer/test.yml/master?enable=pin","Warn: goCommand not pinned by hash: .github/workflows/test.yml:29","Info:   0 out of   6 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 third-party GitHubAction dependencies pinned","Info:   0 out of   1 goCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Code-Review","score":0,"reason":"Found 1/22 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/codecov.yml:1","Warn: no topLevel permission defined: .github/workflows/release.yml:1","Warn: no topLevel permission defined: .github/workflows/test.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 18 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-23T10:52:41.057Z","repository_id":46267834,"created_at":"2025-08-23T10:52:41.057Z","updated_at":"2025-08-23T10:52:41.057Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29005658,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-02T04:25:24.522Z","status":"ssl_error","status_checked_at":"2026-02-02T04:24:51.069Z","response_time":58,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["golang","helper","humanizer","string-manipulation"],"created_at":"2026-02-02T04:39:58.433Z","updated_at":"2026-02-02T04:39:58.560Z","avatar_url":"https://github.com/sbani.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Humanizer\n[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](LICENSE.md) ![Test Workflow](https://github.com/sbani/go-humanizer/actions/workflows/test.yml/badge.svg) [![Go Report Card](https://goreportcard.com/badge/github.com/sbani/go-humanizer)](https://goreportcard.com/report/github.com/sbani/go-humanizer) [![codecov](https://codecov.io/gh/sbani/go-humanizer/branch/master/graph/badge.svg)](https://codecov.io/gh/sbani/go-humanizer) [![GoDoc](https://godoc.org/github.com/sbani/go-humanizer?status.svg)](https://godoc.org/github.com/sbani/go-humanizer)\n\nHumanize values to make them easier to read.\n\n## Installation\n```bash\ngo get github.com/sbani/go-humanizer\n```\n\n## Usage\n\n### Strings\n\n#### Humanize\n```go\nimport \"github.com/sbani/go-humanizer/strings\"\n\nHumanize(\"news_count\", true) // \"News count\"\nHumanize(\"User\", false) // \"user\"\nHumanize(\"news_id\", true) // \"News\"\n```\n\n#### Truncate\nTruncate string but never cut within a word.\n```go\nimport \"github.com/sbani/go-humanizer/strings\"\n\ntextShort := \"Short text\"\nTruncate(textShort, 1) // Short\nTruncate(textShort, 6) // Short\nTruncate(textShort, 7) // Short text\n```\n\n#### Bool\n```go\nimport \"github.com/sbani/go-humanizer/strings\"\n\nToBool(textShort, \"no\") // false\nToBool(textShort, \"false\") // false\nToBool(textShort, \"yes\") // true\n```\n### Time\n\n#### Difference\n```go\nimport \"github.com/sbani/go-humanizer/time\"\n\nbaseTime := time.Date(2016, 11, 3, 13, 0, 0, 0, time.UTC)\nDifference(baseTime, baseTime) // \"just now\"\nDifference(baseTime, baseTime.Add(5*time.Second)) // \"5 seconds from now\"\nDifference(baseTime, baseTime.Add(-61*time.Second)) // \"1 minute ago\"\nDifference(baseTime, baseTime.Add(-(15*time.Minute+3*time.Nanosecond))) // \"15 minutes ago\"\nDifference(baseTime, baseTime.Add(2*time.Hour+3*time.Minute)) // \"2 hours from now\"\nDifference(baseTime, baseTime.Add(-(25*time.Hour))) // \"1 day ago\"\nDifference(baseTime, baseTime.Add(14*24*time.Hour)) // \"2 weeks from now\"\nDifference(baseTime, baseTime.Add(-31*24*time.Hour)) // \"1 month ago\"\nDifference(baseTime, baseTime.Add(366*24*time.Hour)) // \"1 year from now\"\n```\n\n### Units\n\n#### Binary Suffix\n```go\nimport \"github.com/sbani/go-humanizer/units\"\n\ns := BinarySuffix(0) // \"0 bytes\"\ns := BinarySuffix(1536) // \"1.5 kB\"\ns := BinarySuffix(1048576 * 5) // \"5.00 MB\"\ns := BinarySuffix(1073741824 * 2) // \"2.00 GB\"\n```\n### Numbers\n\n#### Ordinalize\n```go\nimport \"github.com/sbani/go-humanizer/numbers\"\n\nOrdinalize(0) // \"0th\"\nOrdinalize(1) // \"1st\"\nOrdinalize(2) // \"2nd\"\nOrdinalize(23) // \"23rd\"\nOrdinalize(1002) // \"1002nd\"\nOrdinalize(-111) // \"-111th\"\n```\n\n#### Ordinal\n```go\nimport \"github.com/sbani/go-humanizer/numbers\"\n\nOrdinal(0) // \"th\"\nOrdinal(1) // \"st\"\nOrdinal(2) // \"nd\"\nOrdinal(23) // \"rd\"\nOrdinal(1002) // \"nd\"\nOrdinal(-111) // \"th\"\n```\n#### Roman\n```go\nimport \"github.com/sbani/go-humanizer/numbers\"\n\ns, err := ToRoman(1) // \"I\"\ns, err := ToRomanToRoman(5) // \"V\"\ns, err := ToRomanToRoman(1300) // \"MCCC\"\n\ni, err := FromRoman(\"MMMCMXCIX\") // 3999\ni, err := FromRoman(\"V\") // 5\ni, err := FromRoman(\"CXXV\") // 125\n```\n\n### Collection\n\n#### Oxford\n```go\nimport \"github.com/sbani/go-humanizer/collection\"\n\nOxford([]string{\"Albert\"}, -1) // \"Albert\"\nOxford([]string{\"Albert\", \"Norbert\"}, -1) // \"Albert and Norbert\"\nOxford([]string{\"Albert\", \"Norbert\", \"Michael\", \"Kevin\"}, -1) // \"Albert, Norbert, Michael, and Kevin\"\nOxford([]string{\"Albert\", \"Norbert\", \"Michael\", \"Kevin\"}, 2)) // Albert, Norbert, and 2 more\n```\n\n## License\nMIT License. See LICENSE file for more informations.\n\n## Credits\nSpecial thank goes to [PHP Humanizer](https://github.com/coduo/php-humanizer).\n\n## Contributions\nContributions are very welcome! Feel free to contact me, send a PR or open an issue.\n\n## Roadmap\nThings that are missing:\n- [x] Strings: Humanize\n- [x] Strings: Truncate\n- [x] Numbers: Roman\n- [x] Numbers: Ordinal\n- [x] Collection: Oxford\n- [x] Numbers: Binary Suffix\n- [x] Numbers: Metric Suffix\n- [x] Date time: Difference\n- [ ] Date time: Precise difference\n- [ ] Translations\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsbani%2Fgo-humanizer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsbani%2Fgo-humanizer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsbani%2Fgo-humanizer/lists"}