Skip to content

Commit 46b2a2b

Browse files
ondrej-tuceks-m-i-t-a
authored andcommitted
Improve docs
1 parent 5ff4014 commit 46b2a2b

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lib/validatex/validation.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,9 @@ defmodule Validatex.Validation do
150150
"name" => {:field, "bar", :not_validated},
151151
"surname" => {:field, "foo", {:valid, "foo"}}
152152
}
153-
iex> Validatex.Validation.apply(data,["name", "surname"], & &1)
153+
iex> Validatex.Validation.apply(data, ["name", "surname"], & &1)
154154
{:invalid, "'name' field isn't valid.'"}
155-
iex> Validatex.Validation.apply(data,["surname"],
155+
iex> Validatex.Validation.apply(data, ["surname"],
156156
...> fn %{"surname" => s} -> %{"surname" => String.capitalize(s)} end)
157157
{:valid, %{"surname" => "Foo"}}
158158

lib/validatex/validators.ex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ defmodule Validatex.Validators do
33
This module provides a few functions for validating data.
44
55
All functions return [Result](https://hexdocs.pm/result/api-reference.html).
6-
It means, if an input value is correct, function returns a tuple `{:ok, val}`.
7-
If not then `{:error, "msg"}`.
6+
It means, if an input value is correct (i.e. the value satisfies to given validation),
7+
function returns a tuple `{:ok, val}`. If not then `{:error, "msg"}`.
88
99
Usage:
1010
1111
Let say that you have a few input forms on your page, for instance: name,
12-
surname, password etc. Now you want to validate that the filled data are correct
12+
surname, password etc. Now you want to validate whether the filled data are correct
1313
for each field. So you create somewhere inside your project a module
1414
[Validators](https://github.com/iodevs/validatex_example/blob/master/lib/server/validators.ex)
1515
which will be containing any of functions like bellow.

0 commit comments

Comments
 (0)