Skip to content

dc0d/caseconv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

923e4de · May 13, 2021

History

24 Commits
May 13, 2021
Jul 29, 2020
Mar 22, 2021
Jun 9, 2020
May 13, 2021
Jan 6, 2021
Jun 9, 2020
May 13, 2021
May 13, 2021
May 13, 2021
Aug 19, 2020
May 13, 2021
May 13, 2021
Jun 9, 2020
May 13, 2021
Jun 9, 2020
May 13, 2021
Jun 9, 2020
May 13, 2021

Repository files navigation

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:

package main

import (
	"fmt"

	"github.com/dc0d/caseconv"
)

func main() {
	input := "The quick brown fox jumps over the lazy dog"

	fmt.Println(caseconv.ToCamel(input))
	fmt.Println(caseconv.ToPascal(input))
	fmt.Println(caseconv.ToKebab(input))
	fmt.Println(caseconv.ToSnake(input))
}

And the output would be:

theQuickBrownFoxJumpsOverTheLazyDog
TheQuickBrownFoxJumpsOverTheLazyDog
the-quick-brown-fox-jumps-over-the-lazy-dog
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.