Skip to content

Commit

Permalink
Version 0.1.1 release
Browse files Browse the repository at this point in the history
  • Loading branch information
sobolevn committed Jul 12, 2017
1 parent b9a3e04 commit 34bf2e4
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 20 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Changelog

## Version 0.1.1

### Improvements

- Adds `Path/case`, `dot.case`, and `CONTANT_CASE`
- Updates tests

### Documentation

- Updates documentation
- Updates README


## Version 0.1.0

Expand Down
67 changes: 48 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
`Recase` helps you to convert a string from any case to any case.


## Why?

One 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:

> 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.

## Installation

```elixir
Expand All @@ -18,44 +25,66 @@ end

### Upper

```elixir
Recase.to_upper("some-value")
# => "SomeValue"
Upper (or Pascal) 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.

Recase.to_upper("Some value")
# => "SomeValue"
```elixir
Recase.to_upper("some-value") # => "SomeValue"
Recase.to_upper("Some value") # => "SomeValue"
```

### Camel

```elixir
Recase.to_camel("some-value")
# => "someValue"
Camel 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.

Recase.to_camel("Some Value")
# => "someValue"
```elixir
Recase.to_camel("some-value") # => "someValue"
Recase.to_camel("Some Value") # => "someValue"
```

### Snake

```elixir
Recase.to_snake("someValue")
# => "some_value"
Snake cases uses all lower case. Uses `_` as a separator.

Recase.to_snake("Some Value")
# => "some_value"
```elixir
Recase.to_snake("someValue") # => "some_value"
Recase.to_snake("Some Value") # => "some_value"
```

### Kebab

Kebab cases uses all lower case. Uses `-` as a separator.

```elixir
Recase.to_kebab("someValue") # => "some-value"
Recase.to_kebab("Some Value") # => "some-value"
```

### Constant

Constant case uses all upper case. Uses `_` as a separator.

```elixir
Recase.to_kebab("someValue")
# => "some-value"
Recase.to_constant("SomeValue") # => "SOME_VALUE"
Recase.to_constant("some value") # => "SOME_VALUE"
```

### Dot

Recase.to_kebab("Some Value")
# => "some-value"
Dot case uses all lower case similar to snake case. Uses `.` as a separator.

```elixir
Recase.to_dot("SomeValue") # => "some.value"
Recase.to_dot("some value") # => "some.value"
```

### Path

Path case preserves case, you can also provide a separator as the second argument.

```elixir
Recase.to_path("SomeValue") # => "Some/Value"
Recase.to_path("some value", "\\") # => "some\\value"
```

## License

Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule Recase.Mixfile do
use Mix.Project

@version "0.1.0"
@version "0.1.1"
@url "https://github.com/sobolevn/recase"

def project do
Expand Down
2 changes: 2 additions & 0 deletions test/recase_test/camel_case_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ defmodule Recase.CamelCaseTest do
assert convert("camel_case") == "camelCase"
assert convert("CamelCase") == "camelCase"
assert convert("camelCase") == "camelCase"
assert convert("CAMelCase") == "camelCase"
assert convert("camel-casE") == "camelCase"
end

test "should not modify extra chars" do
Expand Down

0 comments on commit 34bf2e4

Please sign in to comment.