This commit is contained in:
Jack Francis 2018-06-08 13:41:34 -07:00 коммит произвёл GitHub
Родитель 4416dd2534
Коммит 4f6df79776
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
6 изменённых файлов: 87 добавлений и 2 удалений

6
glide.lock сгенерированный
Просмотреть файл

@ -1,5 +1,5 @@
hash: f01ea3a7c4236485de95f94f24a72e132da8aa547346a1577d5506646ad28231
updated: 2018-06-08T10:05:57.441795-07:00
hash: 6fa6f282ecddc833638528e7142991e81fbe33987514e2da1ece181a6470c568
updated: 2018-06-08T11:35:55.674334-07:00
imports:
- name: github.com/alexcesaro/statsd
version: 7fea3f0d2fab1ad973e641e51dba45443a311a90
@ -28,6 +28,8 @@ imports:
version: 2ee87856327ba09384cabd113bc6b5d174e9ec0f
- name: github.com/dgrijalva/jwt-go
version: dbeaa9332f19a944acb5736b4456cfcc02140e29
- name: github.com/etgryphon/stringUp
version: 31534ccd8cac1d3d205c906ea5722928b045ed8c
- name: github.com/ghodss/yaml
version: 0ca9ea5df5451ffdf184b4428c902747c2c11cd7
- name: github.com/go-playground/locales

Просмотреть файл

@ -65,6 +65,7 @@ import:
version: 1.0
- package: github.com/rjtsdl/conform
version: 1.2.1
- package: github.com/etgryphon/stringUp
testImport:
# glide isn't able to mutually reconcile pinned versions of these deps
- package: github.com/onsi/gomega

1
vendor/github.com/etgryphon/stringUp/.gitignore сгенерированный поставляемый Normal file
Просмотреть файл

@ -0,0 +1 @@
.project

8
vendor/github.com/etgryphon/stringUp/README.md сгенерированный поставляемый Normal file
Просмотреть файл

@ -0,0 +1,8 @@
# StringUp: Golang Extension Library for Strings!
`StringUp` is a micro-package that has some useful string functionality for your Golang Project. Current Functions:
+ `CamelCase` - converts strings to their camel case equivalent
+ Example: `this is it` => `thisIsIt`, `this\_is\_it` => `thisIsIt`, `this-is-it` => `thisIsIt`
More work is being done...Kind of using this a dumping ground for string functions that I need in other projects

18
vendor/github.com/etgryphon/stringUp/stringUp.go сгенерированный поставляемый Normal file
Просмотреть файл

@ -0,0 +1,18 @@
package stringUp
import (
"regexp"
"bytes"
)
var camelingRegex = regexp.MustCompile("[0-9A-Za-z]+")
func CamelCase(src string)(string){
byteSrc := []byte(src)
chunks := camelingRegex.FindAll(byteSrc, -1)
for idx, val := range chunks {
if idx > 0 { chunks[idx] = bytes.Title(val) }
}
return string(bytes.Join(chunks, nil))
}

55
vendor/github.com/etgryphon/stringUp/stringUp_test.go сгенерированный поставляемый Normal file
Просмотреть файл

@ -0,0 +1,55 @@
package stringUp
import (
"testing"
)
func TestCamelCased(t *testing.T) {
const cameled,upCameled = "thisIsIt", "ThisIsItBob"
if x := CamelCase(cameled); x != cameled {
t.Errorf("CamelCase(%v) = %v, want %v", cameled, x, cameled)
}
if x := CamelCase(upCameled); x != upCameled {
t.Errorf("CamelCase(%v) = %v, want %v", upCameled, x, upCameled)
}
}
func TestCamelCaseSpaced(t *testing.T) {
const src,upSrc = "this is it", "This Is It Bob"
if x := CamelCase(src); x != "thisIsIt" {
t.Errorf("CamelCase(%v) = %v, want %v", src, x, "thisIsIt")
}
if x := CamelCase(upSrc); x != "ThisIsItBob" {
t.Errorf("CamelCase(%v) = %v, want %v", upSrc, x, "ThisIsItBob")
}
}
func TestCamelCaseUnderscored(t *testing.T) {
const src,upSrc = "this_is_it", "This_Is_It_Bob"
if x := CamelCase(src); x != "thisIsIt" {
t.Errorf("CamelCase(%v) = %v, want %v", src, x, "thisIsIt")
}
if x := CamelCase(upSrc); x != "ThisIsItBob" {
t.Errorf("CamelCase(%v) = %v, want %v", upSrc, x, "ThisIsItBob")
}
}
func TestCamelCaseDashed(t *testing.T) {
const src,upSrc = "this-is-it", "This-Is-It-Bob"
if x := CamelCase(src); x != "thisIsIt" {
t.Errorf("CamelCase(%v) = %v, want %v", src, x, "thisIsIt")
}
if x := CamelCase(upSrc); x != "ThisIsItBob" {
t.Errorf("CamelCase(%v) = %v, want %v", upSrc, x, "ThisIsItBob")
}
}
func TestCamelCaseMixed(t *testing.T) {
const src,upSrc = "-this is_it", "This Is_It-Bob"
if x := CamelCase(src); x != "thisIsIt" {
t.Errorf("CamelCase(%v) = %v, want %v", src, x, "thisIsIt")
}
if x := CamelCase(upSrc); x != "ThisIsItBob" {
t.Errorf("CamelCase(%v) = %v, want %v", upSrc, x, "ThisIsItBob")
}
}