Skip to content
This repository has been archived by the owner on Dec 12, 2021. It is now read-only.

Commit

Permalink
Fix some issues with the documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
ansman committed Nov 25, 2016
1 parent ded9af6 commit 5a6b158
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1744,15 +1744,14 @@ <h2>Validators</h2>
<li><code>undefined</code></li>
<li><code>{}</code> (empty objects)</li>
<li><code>[]</code> (empty arrays)</li>
<li><code>""</code> (empty string)</li>
<li><code>" "</code> (whitespace only string)</li>
</ul>
<p class="description">
You can additionally use the <code>allowEmpty</code> to also
reject these values:
If you don't want to reject empty objects, arrays or strings
you can set the <code>allowEmpty</code> option to
<code>true</code>.
</p>
<ul>
<li><code>""</code> (empty string)</li>
<li><code>" "</code> (whitespace only string)</li>
</ul>
<p class="notes">
<b>Important!</b> All other values are considered valid (including functions)!
</p>
Expand All @@ -1763,6 +1762,12 @@ <h2>Validators</h2>
validate({username: "ansman"}, {username: {presence: true}});
// =&gt; undefined

validate({input: ""}, {input: {presence: true}});
// =&gt; {"input:" ["Input can't be blank"]}

validate({input: ""}, {input: {presence: {allowEmpty: true}}});
// =&gt; undefined

validate({}, {username: {presence: {message: "is required"}}});
// =&gt; {"username": ["Username is required"]}

Expand Down

0 comments on commit 5a6b158

Please sign in to comment.