https://github.com/eyedea-io/syncano-validate
Client/Server side validation library based on Laravel.
https://github.com/eyedea-io/syncano-validate
syncano validation
Last synced: 8 months ago
JSON representation
Client/Server side validation library based on Laravel.
- Host: GitHub
- URL: https://github.com/eyedea-io/syncano-validate
- Owner: eyedea-io
- Created: 2016-12-08T14:30:26.000Z (over 9 years ago)
- Default Branch: devel
- Last Pushed: 2017-10-03T12:18:19.000Z (over 8 years ago)
- Last Synced: 2025-10-08T15:00:12.789Z (9 months ago)
- Topics: syncano, validation
- Language: JavaScript
- Homepage:
- Size: 139 KB
- Stars: 1
- Watchers: 12
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Syncano Validator
> Client/Server side validation library based on Laravel.
[![XO code style][xo-badge]][xo]
[![CircleCI][circleci-badge]][circleci]
[![codecov][codecov-badge]][codecov]
[xo]: https://github.com/sindresorhus/xo
[xo-badge]: https://img.shields.io/badge/code_style-XO-5ed9c7.svg
[circleci]: https://circleci.com/gh/eyedea-io/syncano-validate/tree/devel
[circleci-badge]: https://circleci.com/gh/eyedea-io/syncano-validate.svg?style=shield&circle-token=4f0733cbf425699a9ca0bc95d44ade178e5a7abd
[codecov]: https://codecov.io/gh/eyedea-io/syncano-validate
[codecov-badge]: https://codecov.io/gh/eyedea-io/syncano-validate/branch/devel/graph/badge.svg
```
$ npm install syncano-validate
```
## How to use
```js
import {validate} from 'syncano-validate'
const data = {
firstName: 'John',
lastName: 'Doe',
username: 'john.doe'
email: 'john.doe@example.com',
age: 43,
gender: 'male',
phoneNumber: '555-444-333',
birthDate: '08/25/2017'
}
const rules = {
firstName: 'required|min:2',
lastName: 'required|min:2',
username: 'required|unique:users,username',
email: 'required|email',
age: 'required|numeric|min:18',
gender: 'in:male,female',
phoneNumber: 'regex:[0-9]{3}?-?[0-9]{3}?-?[0-9]{3}',
birthDate: 'date'
}
validate(data, rules)
.then(() => {
// All params valid! Continue code...
})
.catch(errors => {
// Handle errors
})
```
## TODO:
* After (Date)
* Alpha Dash
* Before (Date)
* Between
* Confirmed
* Date Format
* Different
* Dimensions (Image Files)
* File
* Filled
* Image (File)
* In Array
* IP Address
* JSON
* MIME Types
* MIME Type By File Extension
* Nullable
* Not In
* Present
* Same
* Size
* String
* Timezone
* Unique (Database)