{"id":13786648,"url":"https://github.com/miguelpragier/handy","last_synced_at":"2026-03-06T22:05:36.463Z","repository":{"id":57488603,"uuid":"137217252","full_name":"miguelpragier/handy","owner":"miguelpragier","description":"GO Golang Utilities and helpers like validators and string formatters","archived":false,"fork":false,"pushed_at":"2020-09-30T01:22:20.000Z","size":217,"stargazers_count":83,"open_issues_count":0,"forks_count":7,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-10-21T22:39:17.376Z","etag":null,"topics":["cnpj","conversion","cpf","email","go","golang","golang-package","helper-functions","simple","string-manipulation"],"latest_commit_sha":null,"homepage":null,"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/miguelpragier.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}},"created_at":"2018-06-13T13:10:07.000Z","updated_at":"2025-09-20T17:18:11.000Z","dependencies_parsed_at":"2022-08-29T13:31:56.708Z","dependency_job_id":null,"html_url":"https://github.com/miguelpragier/handy","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/miguelpragier/handy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miguelpragier%2Fhandy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miguelpragier%2Fhandy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miguelpragier%2Fhandy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miguelpragier%2Fhandy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/miguelpragier","download_url":"https://codeload.github.com/miguelpragier/handy/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miguelpragier%2Fhandy/sbom","scorecard":{"id":644476,"data":{"date":"2025-08-11","repo":{"name":"github.com/miguelpragier/handy","commit":"d70fcca135490b04823bdd78129c667ac340b88d"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/30 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":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"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":"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":"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":"Dangerous-Workflow","score":-1,"reason":"no workflows found","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":"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":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"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":"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"}}]},"last_synced_at":"2025-08-21T11:45:02.426Z","repository_id":57488603,"created_at":"2025-08-21T11:45:02.426Z","updated_at":"2025-08-21T11:45:02.426Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30200756,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-06T19:07:06.838Z","status":"ssl_error","status_checked_at":"2026-03-06T18:57:34.882Z","response_time":250,"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":["cnpj","conversion","cpf","email","go","golang","golang-package","helper-functions","simple","string-manipulation"],"created_at":"2024-08-03T19:01:26.938Z","updated_at":"2026-03-06T22:05:36.437Z","avatar_url":"https://github.com/miguelpragier.png","language":"Go","funding_links":[],"categories":["Utilities","公用事业公司","工具库","工具库`可以提升效率的通用代码库和工具`","Utility"],"sub_categories":["Utility/Miscellaneous","实用程序/Miscellaneous","HTTP Clients","查询语","Fail injection"],"readme":"![GitHub](https://img.shields.io/github/license/mashape/apistatus.svg) ![GitHub](https://img.shields.io/badge/goDoc-Yes!-blue.svg) \n[![Go Report Card](https://goreportcard.com/badge/github.com/miguelpragier/handy?update)](https://goreportcard.com/report/github.com/miguelpragier/handy) \n[![Coverage Status](https://img.shields.io/badge/coverage-86.8%25-green.svg?style=flat)](https://gocover.io/github.com/miguelpragier/handy?version=1.10.x) [![Build Status](https://travis-ci.org/miguelpragier/handy.svg?branch=master)](https://travis-ci.org/miguelpragier/handy) [![Mentioned in Awesome Go](https://awesome.re/mentioned-badge.svg)](https://github.com/avelino/awesome-go)\n[![CircleCI](https://circleci.com/gh/miguelpragier/handy/tree/master.svg?style=svg)](https://circleci.com/gh/miguelpragier/handy/tree/master)\n![Go Version](https://img.shields.io/badge/GO%20version-%3E%3D1.14-blue)\n\n# Handy Go utilities\nGO Golang Utilities and helpers like validators, sanitizers and string formatters\n\u003cbr\u003e Requires GO v\u003e=1.14\n\n\n# Dependencies\nNone, since v1.1.1\n\n___\nDocumentation :green_book:|\n--------------------------|\n[GoDocs](https://godoc.org/github.com/miguelpragier/handy)|\n___\n\n___\nQuality :point_left:      |\n--------------------------|\n[GoCover](https://gocover.io/github.com/miguelpragier/handy)|\n___\n\n\n# Functions\n```golang\n// CheckEmail returns true if the given sequence is a valid email address\n// See https://tools.ietf.org/html/rfc2822#section-3.4.1 for details about email address anatomy\nfunc CheckEmail(email string) bool {}\n\n// CheckNewPassword Run some basic checks on new password strings, based on given options\n// This routine requires at least 4 (four) characters\n// Example requiring only basic minimum lenght: CheckNewPassword(\"lalala\", \"lalala\", 10, CheckNewPasswordComplexityLowest)\n// Example requiring number and symbol: CheckNewPassword(\"lalala\", \"lalala\", 10, CheckNewPasswordComplexityRequireNumber|CheckNewPasswordComplexityRequireSymbol)\nfunc CheckNewPassword(password, passwordConfirmation string, minimumLenght uint, flagComplexity uint8) uint8 {\n\n// StringHash simply generates a SHA256 hash from the given string\nfunc StringHash(s string) string {}\n\n// OnlyLetters returns only the letters from the given string, after strip all the rest ( numbers, spaces, etc. )\nfunc OnlyLetters(sequence string) string {}\n\n// OnlyDigits returns only the numbers from the given string, after strip all the rest ( letters, spaces, etc. )\nfunc OnlyDigits(sequence string) string {}\n\n// OnlyLettersAndNumbers returns only the letters and numbers from the given string, after strip all the rest, like spaces and special symbols.\nfunc OnlyLettersAndNumbers(sequence string) string {}\n\n// RandomInt returns a rondom integer within the given (inclusive) range\nfunc RandomInt(min, max int) int {}\n\n// StringAsFloat tries to convert a string to float, and if it can't, just returns zero\n// It's limited to one billion\nfunc StringAsFloat(s string, decimalSeparator, thousandsSeparator rune) float64 {}\n\n// StringAsInteger returns the integer value extracted from string, or zero\nfunc StringAsInteger(s string) int {}\n\n// Between checks if param n in between low and high integer params\nfunc Between(n, low, high int) bool {}\n\n// Tif is a simple implementation of the dear ternary IF operator\nfunc Tif(condition bool, tifThen, tifElse interface{}) interface{} {}\n\n// Truncate limits the length of a given string, trimming or not, according parameters\nfunc Truncate(s string, maxLen int, trim bool) string {}\n\n// Transform handles a string according given flags/parametrization, as follows:\n// Available Flags to be used alone or combined:\n//\tTransformNone - Does nothing. It's only for truncation.\n//\tTransformFlagTrim - Trim spaces before and after proccess the input\n//\tTransformFlagLowerCase - Change string case to lower\n//\tTransformFlagUpperCase - Change string case to upper\n//\tTransformFlagOnlyDigits - Filter/strip all but digits\n//\tTransformFlagOnlyLetters - Filter/strip all but letters\n//\tTransformFlagOnlyLettersAndDigits - Filter/strip all but numbers and letters. Removes spaces, punctuation and special symbols\n// \tTransformFlagHash - Apply handy.StringHash() routine to string\nfunc Transform(s string, maxLen int, transformFlags uint8) string {}\n\n// MatchesAny returns true if any of the given items matches ( equals ) the subject ( search parameter )\nfunc MatchesAny(search interface{}, items ...interface{}) bool {}\n\n// HasOnlyNumbers returns true if the sequence is entirely numeric\nfunc HasOnlyNumbers(sequence string) bool {}\n\n// HasOnlyNumbers returns true if the sequence is entirely composed by letters\nfunc HasOnlyLetters(sequence string) bool {}\n\n// TrimLen returns the runes count after trim the spaces\nfunc TrimLen(text string) int {}\n\n// CheckMinLen verifies if the rune-count is greater then or equal the given minimum\n// It returns true if the given string has length greater than or equal than minLength parameter\nfunc CheckMinLen(value string, minLength int) bool {}\n\n// IsNumericType checks if an interface's concrete type corresponds to some of golang native numeric types\nfunc IsNumericType(x interface{}) bool {}\n\n// Bit returns only uint8(0) or uint8(1).\n// It receives an interface, and when it's a number, and when this number is 0 (zero) it returns 0. Otherwise it returns 1 (one)\n// If the interface is not a number, it returns 0 (zero)\nfunc Bit(x interface{}) uint8 {}\n\n// Boolean returns the bool version/interpretation of some value;\n// It receives an interface, and when this is a number, Boolean() returns flase of zero and true for different from zero.\n// If it's a string, try to find \"1\", \"T\", \"TRUE\" to return true.\n// Any other case returns false\nfunc Boolean(x interface{}) bool {}\n\n// Reverse returns the given string written backwards, with letters reversed.\nfunc Reverse(s string) string {}\n\n// CheckPersonName returns true if the name contains at least two words, one \u003e= 3 chars and one \u003e=2 chars.\n// I understand that this is a particular criteria, but this is the OpenSourceMagic, where you can change and adapt to your own specs.\nfunc CheckPersonName(name string, acceptEmpty bool) uint8 {}\n\n// InArray searches for \"item\" in \"array\" and returns true if it's found\n// This func resides here alone only because its long size.\n// TODO Embrace/comprise all native scalar/primitive types\nfunc InArray(array interface{}, item interface{}) bool {}\n\n// ArrayDifferenceAtoB returns the items from A that doesn't exist in B\nfunc ArrayDifferenceAtoB(a, b []int) []int {}\n\n// ArrayDifference returns all items that doesn't exist in both given arrays\nfunc ArrayDifference(a, b []int) []int {}\n\n\n/* DateTime Routines */\n\n// DateTimeAsString formats time.Time variables as strings, considering the format directive\nfunc DateTimeAsString(dt time.Time, format string) string {}\n\n// StringAsDateTime converts a date-time string using given format string and return it as time.Time\nfunc StringAsDateTime(s string, format string) time.Time {}\n\n// CheckDate validates a date using the given format\nfunc CheckDate(format, dateTime string) bool {\n\n// CheckDate returns true if given sequence is a valid date in format yyyymmdd\n// The function removes non-digit characteres like \"yyyy/mm/dd\" or \"yyyy-mm-dd\", filtering to \"yyyymmdd\"\nfunc CheckDateYMD(yyyymmdd string) bool {}\n\n// YMDasDateUTC returns a valid UTC time from the given yyymmdd-formatted sequence\nfunc YMDasDateUTC(yyyymmdd string, utc bool) (time.Time, error) {}\n\n// YMDasDate returns a valid time from the given yyymmdd-formatted sequence\nfunc YMDasDate(yyyymmdd string) (time.Time, error) {}\n\n// ElapsedMonths returns the number of elapsed months between two given dates\nfunc ElapsedMonths(from, to time.Time) int {}\n\n// ElapsedYears returns the number of elapsed years between two given dates\nfunc ElapsedYears(from, to time.Time) int {}\n\n// YearsAge returns the number of years past since a given date\nfunc YearsAge(birthdate time.Time) int {}\n\n/* Brazilian specific routines */\n\n// CheckCPF returns true if the given sequence is a valid cpf\n// CPF is the Brazilian TAXPayerID document for persons\nfunc CheckCPF(cpf string) bool {}\n\n// CheckCNPJ returns true if the cnpj is valid\n// Thanks to https://gopher.net.br/validacao-de-cpf-e-cnpj-em-go/\n// CNPJ is the Brazilian TAXPayerID document for companies\nfunc CheckCNPJ(cnpj string) bool {}\n\n// AmountAsWord receives an int64 e returns the value as its text representation\n// Today I have only the PT-BR text.\n// Ex: AmountAsWord(129) =\u003e \"cento e vinte e nove\"\n// Supports up to one trillion and does not add commas.\nfunc AmountAsWord(n int64) string {}\n\n/* Web/HTTP Specific Routines */\n\n// HTTPRequestAsString gets a parameter coming from a http request as string, truncated to maxLenght\n// Only maxLenght \u003e= 1 is considered. Otherwise, it's ignored\nfunc HTTPRequestAsString(r *http.Request, key string, maxLenght int, transformOptions ...uint8) string {}\n\n// HTTPRequestAsInteger gets a parameter coming from a http request as an integer\n// It tries to guess if it's a signed/negative integer\nfunc HTTPRequestAsInteger(r *http.Request, key string) int {}\n\n// HTTPRequestAsFloat64 gets a parameter coming from a http request as float64 number\n// You have to inform the decimal separator symbol.\n// If decimalSeparator is period, engine considers thousandSeparator is comma, and vice-versa.\nfunc HTTPRequestAsFloat64(r *http.Request, key string, decimalSeparator rune) float64 {}\n\n/* Other Routines  */\n\n// CheckPersonNameResult returns a meaningful message describing the code generated bu CheckPersonName\n// The routine considers the given idiom. The fallback is in english\nfunc CheckPersonNameResult(idiom string, r uint8) string {}\n\n// CheckNewPasswordResult returns a meaningful message describing the code generated bu CheckNewPassword()\n// The routine considers the given idiom. The fallback is in english\nfunc CheckNewPasswordResult(idiom string, r uint8) string {}\n\n```\n---\n\n- [We're here as well at LIBHunt](https://go.libhunt.com/handy-alternatives)\n- [We're also here at GOCover](https://gocover.io/github.com/miguelpragier/handy)\n- [We're here too at GOLangCI](https://golangci.com/r/github.com/miguelpragier/handy)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiguelpragier%2Fhandy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmiguelpragier%2Fhandy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiguelpragier%2Fhandy/lists"}