Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

doc fixups

  • Loading branch information...
commit f516ec85302b95c2a363b6b4a92498d1c0d0188e 1 parent f4c90f5
@bronson authored
Showing with 16 additions and 15 deletions.
  1. +12 −7 README.md
  2. +4 −8 lib/valid.js
View
19 README.md
@@ -47,14 +47,18 @@ A lightweight, chaining validation library.
This library is scary new.
-- test? valid? check? Could these names be more generic?
-- todo: isDate, isBefore, isAfter
-- todo: isEmail() isIP() isUrl() isUUID()
-- Valid is not a great name. it's not even a noun.
-- noexisty is a stupid name
- covert to Rails-like "5 should equal 4" instead of current "5 is not equal to 4"?
+- simplify error objects
+- try to shrink the api, implement kitchen-sink
+- npm publish
+- pass a json schema to array()? factor into RunSubtest & have everything call this.
+- write isDate, isBefore, isAfter
+- write isEmail() isIP() isUrl() isUUID()
+- test coverage?
- Allow putting value first? i.e. Valid(9).lt(12).gt(10) throws "9 is not greater than 10"
+- write an assertion function? Valid.assert(12).integer().min(5);
- convert to using nested functions instead of the `__queue` array?
+- do a doctest somehow
# Introduction
@@ -67,8 +71,9 @@ any number of values:
validation.isValid(10); // returns true.
```
-The error will be a string for simple validations or an object
-for JSON validations (see _Errors_ below).
+check() returns undefined if the validation succeeds, a string like "should not
+be null" if it fails, or an error object for JSON validations (see _Errors_
+below). isValid() just returns true or false.
# Built-In Validations
View
12 lib/valid.js
@@ -1,12 +1,8 @@
-// valid.js
+// valid.js http://github.com/bronson/valid.js
//
-// todo: change error messages to "can't be blank", "must equal blah", etc.
-// todo: can I make a shorter syntax to change the error message?
-// todo: pass a json schema to array()? factor into RunSubtest & have everything call this.
-// todo: dates
-// todo: npm publish
-// todo: test coverage?
-// todo: value first?
+// A simple, chainable validation library under the MIT license.
+// Works in Node, the browser, and anywhere JavaScript should run.
+
var Valid = function Valid() { };
module.exports = Valid;
Please sign in to comment.
Something went wrong with that request. Please try again.