Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 225dfa4

Browse files
committed
docs: improve README
1 parent cd2cd8f commit 225dfa4

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

README.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,31 +24,37 @@ end
2424

2525
## Usage
2626

27-
With Vx, you can define schemata to validate complex data against.
27+
With Vx, you have the capability to define schemata for validating complex data
28+
effortlessly.
2829

2930
You first need to define your schema.
3031

3132
```elixir
3233
schema = Vx.String.t()
3334
```
3435

35-
Then, you can call `Vx.validate/2` or `Vx.validate!/2` to check if a given
36+
After that, you can call `Vx.validate/2` or `Vx.validate!/2` to check if a given
3637
values matches:
3738

3839
```elixir
3940
Vx.validate(schema, "foo")
4041
# :ok
4142
```
4243

43-
When the value does not match, an error is returned (or raised respectively)
44-
pointing out what is wrong:
44+
When the value does not match, an error is returned (or raised, respectively),
45+
indicating the specific issue.
46+
47+
```elixir
48+
Vx.validate(schema, 123)
49+
# {:error, %Vx.Error{...}}
50+
```
4551

4652
```elixir
4753
Vx.validate!(schema, 123)
4854
# ** (Vx.Error) must be a string
4955
```
5056

51-
Some types can be augmented with additional constraints by piping everything
57+
Additional constraints can be added to certain types by piping everything
5258
together:
5359

5460
```elixir

0 commit comments

Comments
 (0)