项目作者: dc0d

项目描述 :
snake, kebab, camel, pascal case conversion
高级语言: Go
项目地址: git://github.com/dc0d/caseconv.git
创建时间: 2018-02-23T12:18:14Z
项目社区:https://github.com/dc0d/caseconv

开源协议:MIT License

下载


PkgGoDev Go Report Card Maintainability Test Coverage

caseconv

This is a Go Module for snake, kebab, camel, pascal case conversion.

It can be used like:

  1. package main
  2. import (
  3. "fmt"
  4. "github.com/dc0d/caseconv"
  5. )
  6. func main() {
  7. input := "The quick brown fox jumps over the lazy dog"
  8. fmt.Println(caseconv.ToCamel(input))
  9. fmt.Println(caseconv.ToPascal(input))
  10. fmt.Println(caseconv.ToKebab(input))
  11. fmt.Println(caseconv.ToSnake(input))
  12. }

And the output would be:

  1. theQuickBrownFoxJumpsOverTheLazyDog
  2. TheQuickBrownFoxJumpsOverTheLazyDog
  3. the-quick-brown-fox-jumps-over-the-lazy-dog
  4. the_quick_brown_fox_jumps_over_the_lazy_dog

Most of test cases are from change-case node package - so far. But the goal was not to follow same conventions.