Renamed 'fromSnakeCase' to 'toCamelCase'

This commit is contained in:
Gustavo Cordova Avila
2024-03-29 13:22:32 -07:00
parent d036213c9c
commit b34e8adb66
3 changed files with 17 additions and 17 deletions

View File

@@ -18,7 +18,7 @@ proc toSnakeCase*(str: string): string =
result.add '_' result.add '_'
prv = ch prv = ch
proc fromSnakeCase*(str: string): string = proc toCamelCase*(str: string): string =
## Convert from SNAKE_CASE to camelCase ## Convert from SNAKE_CASE to camelCase
var usc: bool = false var usc: bool = false
for ch in str: for ch in str:

View File

@@ -1,16 +0,0 @@
# To run these tests, simply execute `nimble test`.
import unittest
import snake_case
test "fromSnakeCase":
check "TO_SNAKE_CASE".fromSnakeCase() == "toSnakeCase"
check "HTTP_SERVER_NAME".fromSnakeCase() == "httpServerName"
check "PORT_NUM".fromSnakeCase() == "portNum"
check "FIRST_NAME_ONLY".fromSnakeCase() == "firstNameOnly"
check "ROSTR_TOKEN".fromSnakeCase() == "rostrToken"
test "all lowercase":
check "thisisatest".fromSnakeCase() == "thisisatest"
test "all uppercase":
check "THISISATEST".fromSnakeCase() == "thisisatest"

View File

@@ -0,0 +1,16 @@
# To run these tests, simply execute `nimble test`.
import unittest
import snake_case
test "toCamelCase":
check "TO_SNAKE_CASE".toCamelCase() == "toSnakeCase"
check "HTTP_SERVER_NAME".toCamelCase() == "httpServerName"
check "PORT_NUM".toCamelCase() == "portNum"
check "FIRST_NAME_ONLY".toCamelCase() == "firstNameOnly"
check "ROSTR_TOKEN".toCamelCase() == "rostrToken"
test "all lowercase":
check "thisisatest".toCamelCase() == "thisisatest"
test "all uppercase":
check "THISISATEST".toCamelCase() == "thisisatest"