Skip to content

Commit

Permalink
[feat] Added upper and lower phrase cases
Browse files Browse the repository at this point in the history
  • Loading branch information
johmsalas committed Jul 11, 2022
1 parent 2d883b1 commit 519e62a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lua/textcase/conversions/stringcase.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ function M.to_camel_case(str)
return ''
end

function M.to_upper_phrase_case(str)
return M.to_dash_case(str):upper():gsub("-", " ")
end

function M.to_lower_phrase_case(str)
return M.to_dash_case(str):lower():gsub("-", " ")
end

function M.to_phrase_case(str)
local lower = M.to_dash_case(str):lower()
lower = lower:gsub("-", " ")
Expand Down
2 changes: 2 additions & 0 deletions lua/textcase/plugin/api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,7 @@ M.to_camel_case = c('to_camel_case', stringcase.to_camel_case)
M.to_pascal_case = c('to_pascal_case', stringcase.to_pascal_case)
M.to_title_case = c('to_title_case', stringcase.to_title_case)
M.to_path_case = c('to_path_case', stringcase.to_path_case)
M.to_upper_phrase_case = c('to_upper_phrase_case', stringcase.to_upper_phrase_case)
M.to_lower_phrase_case = c('to_lower_phrase_case', stringcase.to_lower_phrase_case)

return M

0 comments on commit 519e62a

Please sign in to comment.