Skip to content

Commit

Permalink
Merge pull request #6 from swaibat/ch-add-badges
Browse files Browse the repository at this point in the history
implement javascript in readme
  • Loading branch information
swaibat committed Oct 7, 2019
2 parents 002ed7d + 7372a02 commit f9f3b0c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
10 changes: 7 additions & 3 deletions README.md
Expand Up @@ -7,7 +7,7 @@ A modern javascript object validation node package available on npmjs.com
Basic usage
------------
a simple middleware for you
```
```js
import Check from 'eagle-validator';

export default function validator(req, res, next) {
Expand All @@ -17,18 +17,22 @@ export default function validator(req, res, next) {
new Check({ email: req }).str().req().email(),
];
const invalid = valid.find((e) => e.error);
if (invalid) return sendResult(res, 400, invalid.error);
if (invalid) return res.status(400).send(status:400, message:invalid.error);
return next();
}
```
this will return simplified messages like:

####for required field
#### for required field

```firstName field is required```

```firstName should be a string```

```firstName should be greaterthan 2```

```firstName should be lessthan 19```

```firstName should be alphabetic```

Basic abbrevations used
Expand Down
11 changes: 6 additions & 5 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "eagle-validator",
"version": "1.0.1",
"version": "1.0.6",
"description": "A modern javascript object validation NPM package available on npmjs.com",
"main": "index.js",
"nyc": {
Expand All @@ -19,9 +19,12 @@
"keywords": [
"js-validator",
"javascript",
"validation",
"validation.js",
"input-validation",
"input-validator",
"express-validator",
"validator",
"joi",
"@hapi",
"eagle-validator"
],
"author": "Rumbiiha swaibu",
Expand All @@ -35,9 +38,7 @@
"chai-http": "4.3.0",
"coveralls": "3.0.6",
"esm": "3.2.25",
"express": "4.17.1",
"mocha": "6.2.0",
"nodemon": "1.19.2",
"nyc": "14.1.1"
},
"devDependencies": {
Expand Down

0 comments on commit f9f3b0c

Please sign in to comment.