Skip to content

Commit

Permalink
update docs in README.md with example usage for Base58.decode/1 #13
Browse files Browse the repository at this point in the history
  • Loading branch information
nelsonic committed Apr 25, 2020
1 parent 42fcf6b commit 9af3c7a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@
[![Inline docs](http://inch-ci.org/github/dwyl/base58.svg?branch=master&style=flat-square)](http://inch-ci.org/github/dwyl/base58)
-->

`b58` provides functions `encode/1` and `decode/1` <br />
`Base58` provides two functions to
work with Base58 encoded strings: `Base58.encode/1` and `Base58.decode/1` <br />
`encode/1` takes an **Elixir binary** (_String, Number, etc._)
and returns a Base58 encoded String. <br />
`encode/1` receives a Base58 encoded String and returns a binary.
`decode/1` receives a Base58 encoded String and returns a binary.

See the section [What is an Elixir binary?](#what-is-an-elixir-binary) for more information about the binary type in Elixir.

Expand All @@ -26,7 +27,7 @@ See the section [What is an Elixir binary?](#what-is-an-elixir-binary) for more

```
defp deps do
[b58: "~> 1.0.0"]
[Base58: "~> 1.0.0"]
end
```

Expand All @@ -35,14 +36,14 @@ and run `mix deps.get`
2. Invoke the `encode` function with a binary as parameter:

```
B58.encode("foo")
Base58.encode("foo")
"bQbp"
```

3. Invoke the `decode` function with a `base58` encoded string:

```
B58.encode("hello") |> B58.decode()
Base58.encode("hello") |> Base58.decode()
"hello"
```

Expand Down
2 changes: 1 addition & 1 deletion lib/base58.ex
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
defmodule Base58 do
@moduledoc """
`base58` provides two functions: `encode/1` and `decode/1`.
`Base58` provides two functions: `encode/1` and `decode/1`.
`encode/1` takes an **Elixir binary** (_String, Number, etc._)
and returns a Base58 encoded String.
`decode/1` receives a Base58 encoded String and returns a binary.
Expand Down

0 comments on commit 9af3c7a

Please sign in to comment.