schema
/
1.0.1
schema 1.0.1
Install from the command line:
Learn more about npm packages
$ npm install @rapidom/schema@1.0.1
Install via package.json:
"@rapidom/schema": "1.0.1"
About this version
TypeScript
ready schema validator
NPM / GitHub Packages:
npm i @rapidom/schema
Yarn:
yarn add @rapidom/schema
import Schema from "@rapidom/schema";
const schema = {
username: Schema.string()
.alphanum()
.required(),
name: Schema.object().keys({
first: Schema.string()
.min(3)
.required(),
last: Schema.string().min(3),
}).required(),
datetime: Schema.date().default(Date.now),
};
try {
const result = Schema.object().keys(schema).validate(value);
} catch (error) {
// your error handler
}
for more details read the documents
- Ardalan Amini - Core Maintainer - @ardalanamini
See also the list of contributors who participated in this project.
We use SemVer for versioning. For the versions available, see the releases.
This project is licensed under the MIT License - see the LICENSE file for details