{"id":36446378,"url":"https://github.com/bmj2728/utils","last_synced_at":"2026-01-11T22:45:41.794Z","repository":{"id":304608869,"uuid":"1018670292","full_name":"bmj2728/utils","owner":"bmj2728","description":"a collection of utilities for Go","archived":false,"fork":false,"pushed_at":"2025-08-12T00:56:50.000Z","size":455,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-12T02:33:35.423Z","etag":null,"topics":["case-conversion","edit-distance","go","golang","levenshtein-distance","lorem-ipsum-generator","sanitizer","string-builder","string-generation","string-transformation","strings-manipulation"],"latest_commit_sha":null,"homepage":"https://bmj2728.github.io/utils/","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/bmj2728.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,"zenodo":null}},"created_at":"2025-07-12T19:11:33.000Z","updated_at":"2025-07-17T05:02:20.000Z","dependencies_parsed_at":"2025-07-14T09:01:38.813Z","dependency_job_id":"e63213d1-c523-41aa-87ad-61706773f589","html_url":"https://github.com/bmj2728/utils","commit_stats":null,"previous_names":["bmj2728/utils"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/bmj2728/utils","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bmj2728%2Futils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bmj2728%2Futils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bmj2728%2Futils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bmj2728%2Futils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bmj2728","download_url":"https://codeload.github.com/bmj2728/utils/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bmj2728%2Futils/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28326144,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-11T22:11:01.104Z","status":"ssl_error","status_checked_at":"2026-01-11T22:10:58.990Z","response_time":60,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":["case-conversion","edit-distance","go","golang","levenshtein-distance","lorem-ipsum-generator","sanitizer","string-builder","string-generation","string-transformation","strings-manipulation"],"created_at":"2026-01-11T22:45:41.085Z","updated_at":"2026-01-11T22:45:41.786Z","avatar_url":"https://github.com/bmj2728.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv style=\"text-align: center;\"\u003e\n  \u003ch1\u003eUtils - The Missing Go Utilities Package\u003c/h1\u003e\n  \u003cimg src=\"assets/utils-gopher_transparent.png\" alt=\"utils Gopher Logo\" width=\"500\"/\u003e\n\u003c/div\u003e\n\n\n\u003c!-- Quality \u0026 Testing --\u003e\n[![CodeQL](https://github.com/bmj2728/utils/workflows/CodeQL/badge.svg)](https://github.com/bmj2728/utils/actions?query=workflow%3ACodeQL)\n[![Testing](https://github.com/bmj2728/utils/actions/workflows/test.yml/badge.svg)](https://github.com/bmj2728/utils/actions)\n[![Linter/Formatter](https://github.com/bmj2728/utils/actions/workflows/ci.yml/badge.svg)](https://github.com/bmj2728/utils/actions)\n[![codecov](https://codecov.io/gh/bmj2728/utils/branch/main/graph/badge.svg)](https://codecov.io/gh/bmj2728/utils)\n\n\u003c!-- Code Quality \u0026 Docs --\u003e\n[![Go Report Card](https://goreportcard.com/badge/github.com/bmj2728/utils)](https://goreportcard.com/report/github.com/bmj2728/utils)\n[![Go Reference](https://pkg.go.dev/badge/github.com/bmj2728/utils.svg)](https://pkg.go.dev/github.com/bmj2728/utils)\n\n\u003c!-- Project Info --\u003e\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Go Version](https://img.shields.io/github/go-mod/go-version/bmj2728/utils)](https://golang.org/)\n[![Release](https://img.shields.io/github/v/release/bmj2728/utils?include_prereleases)](https://github.com/bmj2728/utils/releases)\n\n\u003e **Status**: v0.3.1 🚀—Stable API with comprehensive testing\n\nA comprehensive collection of utility packages for Go, designed to fill the gaps in the standard library and provide a consistent, well-tested set of tools for common programming tasks.\n\n## Overview\n\nThis project aims to provide a set of utility packages that follow these principles:\n\n- **Simple**: Easy to understand and use\n- **Consistent**: Predictable APIs across all packages\n- **Well-tested**: High test coverage and robust error handling\n- **Performant**: Optimized for speed and memory usage\n- **Modular**: Use only what you need\n\n## Installation 📦\n\n### Full Library\n```bash\ngo get github.com/bmj2728/utils\n```\n\n### Specific Components\n```bash\n# String utilities only\ngo get github.com/bmj2728/utils/pkg/strutil\n```\n```bash\n# Version utilities only  \ngo get github.com/bmj2728/utils/pkg/version\n```\n\n### Import Examples\n```go\n// Import the full string utilities package\nimport \"github.com/bmj2728/utils/pkg/strutil\"\n```\n```go\n// Import specific utilities\nimport (\n    \"github.com/bmj2728/utils/pkg/strutil\"\n    \"github.com/bmj2728/utils/pkg/version\"\n)\n```\n\n## Key Features ✨\n\n### 🔤 String Utilities (`strutil`)\nThe heart of the library - comprehensive string manipulation with dual APIs!\n\n- **🎯 Dual API Design**: Choose your style - functional for simplicity, builder for chaining\n- **🧹 Sanitization \u0026 Cleaning**: HTML sanitization, whitespace normalization, character filtering\n- **📏 String Comparison**: Levenshtein, Jaro-Winkler, LCS, and more algorithms\n- **📊 Comparison Manager**: Track and organize multiple comparison results *(optional)*\n- **🕐 History Tracking**: Revert transformations with full history *(optional)*\n- **🔧 Text Transformation**: Case conversion, slug generation, truncation, padding\n- **✅ Validation**: Email, URL, numeric, and custom pattern validation\n- **🎲 Generation**: Lorem ipsum text, emails, and placeholder content\n\n### 📊 Version Utilities (`version`)\nBuild-time version management made simple!\n\n- **📋 Version Information**: Embedded build-time version and build details\n- **🔍 Semantic Validation**: Validate and parse semantic versioning format\n\n## Usage Guide 🚀\n\n### 🎭 Choose Your API Style\n\n**Functional API** - Direct function calls for simple operations:\n```go\nimport \"github.com/bmj2728/utils/pkg/strutil\"\n\n// Simple operations\ncleaned := strutil.CleanWhitespace(\"  hello   world  \")  // \"hello world\"\nslug := strutil.Slugify(\"Hello World!\", 20)              // \"hello-world\"\nisValid := strutil.IsEmail(\"user@example.com\")           // true\n```\n\n**Builder API** - Fluent chaining for complex operations:\n```go\nimport \"github.com/bmj2728/utils/pkg/strutil\"\n\n// Chain multiple operations\nresult, err := strutil.New(\"  \u003cdiv\u003eHello World!\u003c/div\u003e  \").\n    CleanWhitespace().\n    SanitizeHTML().\n    ToLower().\n    Slugify(50).\n    Result()\n// Result: \"hello-world\"\n```\n\n### 🧹 String Cleaning \u0026 Sanitization\n\n```go\n// Remove dangerous HTML but keep safe tags\nuserInput := \"\u003cscript\u003ealert('xss')\u003c/script\u003e\u003cp\u003eSafe content\u003c/p\u003e\"\nclean := strutil.SanitizeHTML(userInput)  // \"\u003cp\u003eSafe content\u003c/p\u003e\"\n\n// Clean whitespace and normalize\nmessy := \"  \\t  hello    world  \\n  \"\ntidy := strutil.CleanWhitespace(messy)  // \"hello world\"\n\n// Remove non-printable characters\nwithControl := \"hello\\x00\\x01world\"\nprintable := strutil.RemoveNonPrintable(withControl)  // \"helloworld\"\n```\n\n### 🔧 Text Transformation\n\n```go\n// Case conversions\ntext := \"hello_world\"\ncamel := strutil.ToCamelCase(text)     // \"helloWorld\"\npascal := strutil.ToPascalCase(text)   // \"HelloWorld\"\nkebab := strutil.ToKebabCase(text)     // \"hello-world\"\n\n// String manipulation\noriginal := \"Hello World\"\nprepended := strutil.Prepend(original, \"*********\")      // \"*********Hello World\"\ntruncated := strutil.Truncate(original, 5, \"...\")  // \"Hello...\"\n```\n\n### ✅ Validation \u0026 Generation\n\n```go\n// Validation\nstrutil.IsEmail(\"test@example.com\")     // true\nstrutil.IsURL(\"https://example.com\")    // true\nstrutil.IsNumeric(\"12345\", true)        // true\n\n// Lorem ipsum generation\nsentence := strutil.LoremSentence()     // \"Dapibus dictum sollicitudin congue dignissim hendrerit massa commodo.\"\nemail := strutil.LoremEmail()           // \"lorem@ipsum.amet\"\nparagraph := strutil.LoremParagraph()   // Full paragraph of lorem text\n```\n\n### 📊 Advanced: Comparison Manager *(Optional)*\n\nTrack multiple string comparison results in one place:\n\n```go\n// Create a builder with comparison manager\nmanager := strutil.New(\"hello world\").\n    WithComparisonManager().\n    LevenshteinDistance(\"hello there\").\n    Similarity(\"hello there\", strutil.JaroWinkler).\n    LCSBacktrack(\"hello there\").\n    GetComparisonManager()\n\n// Accessing results\nlevDist, err := manager.GetComparisonResult(strutil.LevDist, \"hello there\").(*strutil.ComparisonResultInt).\nGetScoreInt()\nsim, err := manager.GetSimilarityResult(strutil.JaroWinkler, \"hello there\").GetScore()\nlcs := manager.GetLCSResult(strutil.LCSBacktrackWord, \"hello there\").GetResult()[0]\n\n\n// Get all results for analysis\nallComparisons := manager.GetComparisonResultsMap()\nallSimilarities := manager.GetSimilarityResultsMap()\n```\n\n### 🕐 Advanced: History Tracking *(Optional)*\n\nTrack transformations and revert when needed:\n\n```go\n// Enable history tracking\nresult, err := strutil.New(\"  Hello WORLD!  \").\n    WithHistory(10).                    // Track history, rotating after the tenth change\n    Trim().                             // \"Hello WORLD!\"\n    ToLower().                          // \"hello world!\"\n    ToTitle().                          // \"Hello World!\"\n    Slugify(20).                        // \"hello-world\"\n    Result()\n\n// Access transformation history\nhistory := strutil.New(\"  Hello WORLD!  \").\n    WithHistory(10).\n    Trim().\n    ToLower().\n    GetHistory()\n\nfmt.Println(history.GetAll())  // [\"  Hello WORLD!  \", \"Hello WORLD!\", \"hello world!\"]\n\n// Revert to previous states\nreverted, err := strutil.New(\"  Hello WORLD!  \").\n    WithHistory(10).\n    CleanWhitespace().\n    ToLower().\n    RevertToPrevious().  // Back to \"Hello WORLD!\"\n    Result()\n```\n\n## Documentation 📚\n\nFor complete documentation of all available functions and their usage, please refer to the [Go Reference Documentation](https://pkg.go.dev/github.com/bmj2728/utils).\n\n## Roadmap 🗺️\n\nExciting utilities coming in future releases:\n\n- 📁 **fileoputils** - Safe file operations leveraging Go 1.24+ features\n- 🗄️ **dbutils** - Database utilities and connection management  \n- 🍕 **sliceutils** - Advanced slice manipulation and algorithms\n- 🔢 **floatutils** - Floating-point utilities and math helpers\n- 🐚 **shellutils** - Shell command execution and process management\n- 🌐 **netutils** - Network utilities and HTTP helpers\n\n## Acknowledgements 🙏\n\nThis project stands on the shoulders of giants! We leverage these excellent open-source libraries:\n\n- [**go-edlib**](https://github.com/hbollon/go-edlib) - String comparison and edit distance algorithms for measuring similarity\n- [**bluemonday**](https://github.com/microcosm-cc/bluemonday) - HTML sanitizer for safe HTML cleaning\n- [**go-sanitize**](https://github.com/mrz1836/go-sanitize) - Powerful string cleaning and sanitization functions\n- [**strcase**](https://github.com/iancoleman/strcase) - Converting strings between different case formats\n- [**camelcase**](https://github.com/fatih/camelcase) - Splitting camelCase/PascalCase words into components\n- [**lorelai**](https://github.com/UltiRequiem/lorelai) - Versatile lorem ipsum generator for placeholder content\n- [**go-diacritics**](https://github.com/Regis24GmbH/go-diacritics) - Lightweight diacritics normalization\n- [**stripansi**](https://github.com/acarl005/stripansi) - ANSI escape sequence removal for clean output\n- [**google/uuid**](https://github.com/google/uuid) - Robust UUID implementation\n\n## License\n\nThis project is licensed under the terms of the LICENSE file included in the repository.\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbmj2728%2Futils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbmj2728%2Futils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbmj2728%2Futils/lists"}