diff options
| author | Taras Madan <tarasmadan@google.com> | 2025-01-22 16:07:17 +0100 |
|---|---|---|
| committer | Taras Madan <tarasmadan@google.com> | 2025-01-23 10:42:36 +0000 |
| commit | 7b4377ad9d8a7205416df8d6217ef2b010f89481 (patch) | |
| tree | e6fec4fd12ff807a16d847923f501075bf71d16c /vendor/github.com/iancoleman | |
| parent | 475a4c203afb8b7d3af51c4fd32bb170ff32a45e (diff) | |
vendor: delete
Diffstat (limited to 'vendor/github.com/iancoleman')
| -rw-r--r-- | vendor/github.com/iancoleman/strcase/.travis.yml | 10 | ||||
| -rw-r--r-- | vendor/github.com/iancoleman/strcase/LICENSE | 22 | ||||
| -rw-r--r-- | vendor/github.com/iancoleman/strcase/README.md | 59 | ||||
| -rw-r--r-- | vendor/github.com/iancoleman/strcase/acronyms.go | 13 | ||||
| -rw-r--r-- | vendor/github.com/iancoleman/strcase/camel.go | 87 | ||||
| -rw-r--r-- | vendor/github.com/iancoleman/strcase/doc.go | 12 | ||||
| -rw-r--r-- | vendor/github.com/iancoleman/strcase/snake.go | 115 |
7 files changed, 0 insertions, 318 deletions
diff --git a/vendor/github.com/iancoleman/strcase/.travis.yml b/vendor/github.com/iancoleman/strcase/.travis.yml deleted file mode 100644 index 79ebc5693..000000000 --- a/vendor/github.com/iancoleman/strcase/.travis.yml +++ /dev/null @@ -1,10 +0,0 @@ -sudo: false -language: go -go: - - 1.10.x - - 1.11.x - - 1.12.x - - 1.13.x - - 1.14.x - - 1.15.x - - master diff --git a/vendor/github.com/iancoleman/strcase/LICENSE b/vendor/github.com/iancoleman/strcase/LICENSE deleted file mode 100644 index 3e87ff70e..000000000 --- a/vendor/github.com/iancoleman/strcase/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Ian Coleman -Copyright (c) 2018 Ma_124, <github.com/Ma124> - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, Subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or Substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/vendor/github.com/iancoleman/strcase/README.md b/vendor/github.com/iancoleman/strcase/README.md deleted file mode 100644 index e72d9e97c..000000000 --- a/vendor/github.com/iancoleman/strcase/README.md +++ /dev/null @@ -1,59 +0,0 @@ -# strcase -[](http://godoc.org/github.com/iancoleman/strcase) -[](https://travis-ci.com/iancoleman/strcase) -[](http://gocover.io/github.com/iancoleman/strcase) -[](https://goreportcard.com/report/github.com/iancoleman/strcase) - -strcase is a go package for converting string case to various cases (e.g. [snake case](https://en.wikipedia.org/wiki/Snake_case) or [camel case](https://en.wikipedia.org/wiki/CamelCase)) to see the full conversion table below. - -## Example - -```go -s := "AnyKind of_string" -``` - -| Function | Result | -|-------------------------------------------|----------------------| -| `ToSnake(s)` | `any_kind_of_string` | -| `ToSnakeWithIgnore(s, '.')` | `any_kind.of_string` | -| `ToScreamingSnake(s)` | `ANY_KIND_OF_STRING` | -| `ToKebab(s)` | `any-kind-of-string` | -| `ToScreamingKebab(s)` | `ANY-KIND-OF-STRING` | -| `ToDelimited(s, '.')` | `any.kind.of.string` | -| `ToScreamingDelimited(s, '.', '', true)` | `ANY.KIND.OF.STRING` | -| `ToScreamingDelimited(s, '.', ' ', true)` | `ANY.KIND OF.STRING` | -| `ToCamel(s)` | `AnyKindOfString` | -| `ToLowerCamel(s)` | `anyKindOfString` | - - -## Install - -```bash -go get -u github.com/iancoleman/strcase -``` - -## Custom Acronyms for ToCamel && ToLowerCamel - -Often times text can contain specific acronyms which you need to be handled a certain way. -Out of the box `strcase` treats the string "ID" as "Id" or "id" but there is no way to cater -for every case in the wild. - -To configure your custom acronym globally you can use the following before running any conversion - -```go -import ( - "github.com/iancoleman/strcase" -) - -func init() { - // results in "Api" using ToCamel("API") - // results in "api" using ToLowerCamel("API") - strcase.ConfigureAcronym("API", "api") - - // results in "PostgreSQL" using ToCamel("PostgreSQL") - // results in "postgreSQL" using ToLowerCamel("PostgreSQL") - strcase.ConfigureAcronym("PostgreSQL", "PostgreSQL") - -} - -``` diff --git a/vendor/github.com/iancoleman/strcase/acronyms.go b/vendor/github.com/iancoleman/strcase/acronyms.go deleted file mode 100644 index 7a2fb09ea..000000000 --- a/vendor/github.com/iancoleman/strcase/acronyms.go +++ /dev/null @@ -1,13 +0,0 @@ -package strcase - -import ( - "sync" -) - -var uppercaseAcronym = sync.Map{} - //"ID": "id", - -// ConfigureAcronym allows you to add additional words which will be considered acronyms -func ConfigureAcronym(key, val string) { - uppercaseAcronym.Store(key, val) -} diff --git a/vendor/github.com/iancoleman/strcase/camel.go b/vendor/github.com/iancoleman/strcase/camel.go deleted file mode 100644 index 6b886894a..000000000 --- a/vendor/github.com/iancoleman/strcase/camel.go +++ /dev/null @@ -1,87 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2015 Ian Coleman - * Copyright (c) 2018 Ma_124, <github.com/Ma124> - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, Subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or Substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package strcase - -import ( - "strings" -) - -// Converts a string to CamelCase -func toCamelInitCase(s string, initCase bool) string { - s = strings.TrimSpace(s) - if s == "" { - return s - } - a, hasAcronym := uppercaseAcronym.Load(s) - if hasAcronym { - s = a.(string) - } - - n := strings.Builder{} - n.Grow(len(s)) - capNext := initCase - prevIsCap := false - for i, v := range []byte(s) { - vIsCap := v >= 'A' && v <= 'Z' - vIsLow := v >= 'a' && v <= 'z' - if capNext { - if vIsLow { - v += 'A' - v -= 'a' - } - } else if i == 0 { - if vIsCap { - v += 'a' - v -= 'A' - } - } else if prevIsCap && vIsCap && !hasAcronym { - v += 'a' - v -= 'A' - } - prevIsCap = vIsCap - - if vIsCap || vIsLow { - n.WriteByte(v) - capNext = false - } else if vIsNum := v >= '0' && v <= '9'; vIsNum { - n.WriteByte(v) - capNext = true - } else { - capNext = v == '_' || v == ' ' || v == '-' || v == '.' - } - } - return n.String() -} - -// ToCamel converts a string to CamelCase -func ToCamel(s string) string { - return toCamelInitCase(s, true) -} - -// ToLowerCamel converts a string to lowerCamelCase -func ToLowerCamel(s string) string { - return toCamelInitCase(s, false) -} diff --git a/vendor/github.com/iancoleman/strcase/doc.go b/vendor/github.com/iancoleman/strcase/doc.go deleted file mode 100644 index 5e1825b9e..000000000 --- a/vendor/github.com/iancoleman/strcase/doc.go +++ /dev/null @@ -1,12 +0,0 @@ -// Package strcase converts strings to various cases. See the conversion table below: -// | Function | Result | -// |---------------------------------|--------------------| -// | ToSnake(s) | any_kind_of_string | -// | ToScreamingSnake(s) | ANY_KIND_OF_STRING | -// | ToKebab(s) | any-kind-of-string | -// | ToScreamingKebab(s) | ANY-KIND-OF-STRING | -// | ToDelimited(s, '.') | any.kind.of.string | -// | ToScreamingDelimited(s, '.') | ANY.KIND.OF.STRING | -// | ToCamel(s) | AnyKindOfString | -// | ToLowerCamel(s) | anyKindOfString | -package strcase diff --git a/vendor/github.com/iancoleman/strcase/snake.go b/vendor/github.com/iancoleman/strcase/snake.go deleted file mode 100644 index df018bc7a..000000000 --- a/vendor/github.com/iancoleman/strcase/snake.go +++ /dev/null @@ -1,115 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2015 Ian Coleman - * Copyright (c) 2018 Ma_124, <github.com/Ma124> - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, Subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or Substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package strcase - -import ( - "strings" -) - -// ToSnake converts a string to snake_case -func ToSnake(s string) string { - return ToDelimited(s, '_') -} - -func ToSnakeWithIgnore(s string, ignore string) string { - return ToScreamingDelimited(s, '_', ignore, false) -} - -// ToScreamingSnake converts a string to SCREAMING_SNAKE_CASE -func ToScreamingSnake(s string) string { - return ToScreamingDelimited(s, '_', "", true) -} - -// ToKebab converts a string to kebab-case -func ToKebab(s string) string { - return ToDelimited(s, '-') -} - -// ToScreamingKebab converts a string to SCREAMING-KEBAB-CASE -func ToScreamingKebab(s string) string { - return ToScreamingDelimited(s, '-', "", true) -} - -// ToDelimited converts a string to delimited.snake.case -// (in this case `delimiter = '.'`) -func ToDelimited(s string, delimiter uint8) string { - return ToScreamingDelimited(s, delimiter, "", false) -} - -// ToScreamingDelimited converts a string to SCREAMING.DELIMITED.SNAKE.CASE -// (in this case `delimiter = '.'; screaming = true`) -// or delimited.snake.case -// (in this case `delimiter = '.'; screaming = false`) -func ToScreamingDelimited(s string, delimiter uint8, ignore string, screaming bool) string { - s = strings.TrimSpace(s) - n := strings.Builder{} - n.Grow(len(s) + 2) // nominal 2 bytes of extra space for inserted delimiters - for i, v := range []byte(s) { - vIsCap := v >= 'A' && v <= 'Z' - vIsLow := v >= 'a' && v <= 'z' - if vIsLow && screaming { - v += 'A' - v -= 'a' - } else if vIsCap && !screaming { - v += 'a' - v -= 'A' - } - - // treat acronyms as words, eg for JSONData -> JSON is a whole word - if i+1 < len(s) { - next := s[i+1] - vIsNum := v >= '0' && v <= '9' - nextIsCap := next >= 'A' && next <= 'Z' - nextIsLow := next >= 'a' && next <= 'z' - nextIsNum := next >= '0' && next <= '9' - // add underscore if next letter case type is changed - if (vIsCap && (nextIsLow || nextIsNum)) || (vIsLow && (nextIsCap || nextIsNum)) || (vIsNum && (nextIsCap || nextIsLow)) { - prevIgnore := ignore != "" && i > 0 && strings.ContainsAny(string(s[i-1]), ignore) - if !prevIgnore { - if vIsCap && nextIsLow { - if prevIsCap := i > 0 && s[i-1] >= 'A' && s[i-1] <= 'Z'; prevIsCap { - n.WriteByte(delimiter) - } - } - n.WriteByte(v) - if vIsLow || vIsNum || nextIsNum { - n.WriteByte(delimiter) - } - continue - } - } - } - - if (v == ' ' || v == '_' || v == '-' || v == '.') && !strings.ContainsAny(string(v), ignore) { - // replace space/underscore/hyphen/dot with delimiter - n.WriteByte(delimiter) - } else { - n.WriteByte(v) - } - } - - return n.String() -} |
