{"id":19001106,"url":"https://github.com/wemake-services/recase","last_synced_at":"2025-05-14T19:04:53.543Z","repository":{"id":40307717,"uuid":"96619000","full_name":"wemake-services/recase","owner":"wemake-services","description":":recycle: Convert strings to any case.","archived":false,"fork":false,"pushed_at":"2025-04-18T09:16:10.000Z","size":302,"stargazers_count":229,"open_issues_count":9,"forks_count":19,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-05-08T20:27:12.008Z","etag":null,"topics":["camelcase","cases","elixir","elixir-lang","pascalcase","snake-case"],"latest_commit_sha":null,"homepage":"https://hexdocs.pm/recase/readme.html","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wemake-services.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"wemake-services","custom":"https://boosty.to/sobolevn"}},"created_at":"2017-07-08T12:55:05.000Z","updated_at":"2025-04-28T18:30:52.000Z","dependencies_parsed_at":"2024-01-29T10:10:10.105Z","dependency_job_id":"e00ab5f0-27e1-40c9-bd83-cc6f48581bef","html_url":"https://github.com/wemake-services/recase","commit_stats":{"total_commits":177,"total_committers":17,"mean_commits":"10.411764705882353","dds":0.7231638418079096,"last_synced_commit":"293a3581fd9f5cbf6e64bc44018578f8bf804849"},"previous_names":["sobolevn/recase"],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wemake-services%2Frecase","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wemake-services%2Frecase/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wemake-services%2Frecase/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wemake-services%2Frecase/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wemake-services","download_url":"https://codeload.github.com/wemake-services/recase/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253886104,"owners_count":21978998,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["camelcase","cases","elixir","elixir-lang","pascalcase","snake-case"],"created_at":"2024-11-08T18:09:53.762Z","updated_at":"2025-05-14T19:04:53.518Z","avatar_url":"https://github.com/wemake-services.png","language":"Elixir","readme":"# Recase\n\n![Recase](https://raw.githubusercontent.com/wemake-services/recase/master/media/logo.png)\n\n[![Build Status](https://github.com/wemake-services/recase/workflows/test/badge.svg?branch=master\u0026event=push)](https://github.com/wemake-services/recase/actions?query=workflow%3Atest)\n[![Coverage Status](https://coveralls.io/repos/github/wemake-services/recase/badge.svg?branch=master)](https://coveralls.io/github/wemake-services/recase?branch=master)\n[![Hex Version](https://img.shields.io/hexpm/v/recase.svg)](https://hex.pm/packages/recase)\n[![Hex Docs](https://img.shields.io/badge/hex-docs-lightgreen.svg)](https://hexdocs.pm/recase/)\n[![Total Download](https://img.shields.io/hexpm/dt/recase.svg)](https://hex.pm/packages/recase)\n[![License](https://img.shields.io/hexpm/l/recase.svg)](https://github.com/wemake-services/recase/blob/master/LICENSE.md)\n[![Last Updated](https://img.shields.io/github/last-commit/wemake-services/recase.svg)](https://github.com/wemake-services/recase/commits/master)\n\n`Recase` helps you to convert a string from any case to any case.\n\n## Why?\n\nOne can ask: \"Why should I use `Recase` when I can use built-in `Macro` module?\". But, you have to keep in mind that `Macro`'s functions are [not suitable](https://github.com/elixir-lang/elixir/blob/4aa81645b0588b56fb61cd154dcaee354732aa5c/lib/elixir/lib/macro.ex#L1265) for general case usage:\n\n\u003e Do not use it as a general mechanism for underscoring or camelizing strings as it does not support Unicode or characters that are not valid in Elixir identifiers.\n\n## Installation\n\n```elixir\ndef deps do\n  [\n    {:recase, \"~\u003e 0.5\"}\n  ]\nend\n```\n\n## Usage\n\n### Pascal\n\nPascal (or Upper) case uses mixed case with lower and upper cased characters. Separates words from each other with the upper case letters. Starts with upper case letter.\n\n```elixir\nRecase.to_pascal(\"some-value\") # =\u003e \"SomeValue\"\nRecase.to_pascal(\"Some value\") # =\u003e \"SomeValue\"\n```\n\n### Camel\n\nCamel case uses mixed case with lower and upper cased characters. Separates words from each other with the upper cased letters. Starts with lower case letter.\n\n```elixir\nRecase.to_camel(\"some-value\") # =\u003e \"someValue\"\nRecase.to_camel(\"Some Value\") # =\u003e \"someValue\"\n```\n\n### Snake\n\nSnake cases uses all lower case. Uses `_` as a separator.\n\n```elixir\nRecase.to_snake(\"someValue\") # =\u003e \"some_value\"\nRecase.to_snake(\"Some Value\") # =\u003e \"some_value\"\n```\n\n### Kebab\n\nKebab cases uses all lower case. Uses `-` as a separator.\n\n```elixir\nRecase.to_kebab(\"someValue\") # =\u003e \"some-value\"\nRecase.to_kebab(\"Some Value\") # =\u003e \"some-value\"\n```\n\n### Constant\n\nConstant case uses all upper case. Uses `_` as a separator.\n\n```elixir\nRecase.to_constant(\"SomeValue\") # =\u003e \"SOME_VALUE\"\nRecase.to_constant(\"some value\") # =\u003e \"SOME_VALUE\"\n```\n\n### Dot\n\nDot case uses all lower case similar to snake case. Uses `.` as a separator.\n\n```elixir\nRecase.to_dot(\"SomeValue\") # =\u003e \"some.value\"\nRecase.to_dot(\"some value\") # =\u003e \"some.value\"\n```\n\n### Path\n\nPath case preserves case, you can also provide a separator as the second argument.\n\n```elixir\nRecase.to_path(\"SomeValue\") # =\u003e \"Some/Value\"\nRecase.to_path(\"some value\", \"\\\\\") # =\u003e \"some\\\\value\"\n```\n\n### Sentence\n\nSentence case uses the same rules as regular sentence.\nFirst letter is uppercase all others letters are lowercase separated by spaces.\n\n```elixir\nRecase.to_sentence(\"SomeValue\") # =\u003e \"Some value\"\nRecase.to_sentence(\"some value\") # =\u003e \"Some value\"\n```\n\n### Title\n\nTitle case applies a \"Title Style\" to all words in a sentence.\n\n```elixir\nRecase.to_title(\"some-value\") # =\u003e \"Some Value\"\nRecase.to_title(\"some value\") # =\u003e \"Some Value\"\n```\n\n### Header\n\nHeader case uses the same case as PascalCase, while using `-` as a separator.\n\n```elixir\nRecase.to_header(\"SomeValue\") # =\u003e \"Some-Value\"\nRecase.to_header(\"some value\") # =\u003e \"Some-Value\"\n```\n\n### Enumerable\n\nYou can convert all keys in an enumerable with:\n\n```elixir\nRecase.Enumerable.convert_keys(\n  %{\"yourKey\" =\u003e \"value\"},\n  \u0026Recase.to_snake/1\n) # =\u003e %{\"your_key\" =\u003e \"value\"}\n\nRecase.Enumerable.convert_keys(\n  %{\"your_key\" =\u003e \"value\"},\n  \u0026Recase.to_camel/1\n) # =\u003e %{\"yourKey\" =\u003e \"value\"}\n\nRecase.Enumerable.atomize_keys(\n  %{\"yourKey\" =\u003e \"value\"},\n  \u0026Recase.to_snake/1\n) # =\u003e %{your_key: \"value\"}\n\nRecase.Enumerable.atomize_keys(\n  %{\"your_key\" =\u003e \"value\"},\n  \u0026Recase.to_camel/1\n) # =\u003e %{yourKey: \"value\"}\n```\n\n## Changelog\n\nFull changelog is available [here](./CHANGELOG.md).\n\n## Copyright and License\n\nCopyright (c) 2017 Nikita Sobolev\n\nThis work is free. You can redistribute it and/or modify it under the\nterms of the MIT License. See the [LICENSE.md](./LICENSE.md) file for more details.\n\n## Thanks\n\nThanks to [Gyan Lakhwani](https://github.com/gyanl) for the logo.\n","funding_links":["https://github.com/sponsors/wemake-services","https://boosty.to/sobolevn"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwemake-services%2Frecase","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwemake-services%2Frecase","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwemake-services%2Frecase/lists"}