From 5a6b1583834b8dfae837cf59ba5851dabed427dd Mon Sep 17 00:00:00 2001 From: Nicklas Ansman Giertz Date: Fri, 25 Nov 2016 18:04:44 +0100 Subject: [PATCH] Fix some issues with the documentation --- index.html | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/index.html b/index.html index 3865933..4879691 100644 --- a/index.html +++ b/index.html @@ -1744,15 +1744,14 @@

Validators

  • undefined
  • {} (empty objects)
  • [] (empty arrays)
  • +
  • "" (empty string)
  • +
  • " " (whitespace only string)
  • - You can additionally use the allowEmpty to also - reject these values: + If you don't want to reject empty objects, arrays or strings + you can set the allowEmpty option to + true.

    -

    Important! All other values are considered valid (including functions)!

    @@ -1763,6 +1762,12 @@

    Validators

    validate({username: "ansman"}, {username: {presence: true}}); // => undefined +validate({input: ""}, {input: {presence: true}}); +// => {"input:" ["Input can't be blank"]} + +validate({input: ""}, {input: {presence: {allowEmpty: true}}}); +// => undefined + validate({}, {username: {presence: {message: "is required"}}}); // => {"username": ["Username is required"]}