@viewitjs/validate
ViewitJS framework Validate Module
Last updated 10 months ago by dl-viewit .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @viewitjs/validate 
SYNC missed versions from official npm registry.

Build Status Test Coverage Maintainability

ViewitJS Validate

Viewit JS Validate Module

Getting Started

Please install the package

npm i @viewitjs/validate

How to use it

const Validator = require('@viewitjs/validate')
const validate = new Validator()

Methods

typeOf

Set the type and value

validate.typeOf('string', 'text')
validate.typeOf('number', 2)

const text;
validate.typeOf('undefined', text)

validate.typeOf('null', null)

validate.typeOf('array', [])
validate.typeOf('object', {})
validate.typeOf('function', () => {})
validate.typeOf('symbol', Symbol())

This method return true if the type match with the value

isEmpty

Set value

const value = ''
validate.isEmpty(value)

This method return true if the value is empty

bySchema

Set the schema and data

const schema = {
	id: 'number',
	body: {
		content: 'string'
	}
}

const data = {
	id: 2,
	body: {
		content: 'Hello World!'
	}
}

validate.bySchema(schema, data)

This method return true if the data againts the schema

  • If some property not found or not match with type provided return false

getErrors

Get the array of validation errors

validate.getErrors()

Prerequisites

Before installing, download and install Node.js

V8 or higher is required.

Development

If you want to parcipate please visit viewitjs

Navigate to a project folder where you want to work and fork the repository

git fork git@github.com:viewitjs/validate.git {package name}

Install all dev dependencies

npm install -D

Create new branch and start work & enjoy it

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We are in firsts stages of the development. If you want to contribute with this project please visit:

ViewitJS

Authors

  • Diego Londoño - Viewit Team
  • Elias Valdez - Viewit Team

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments

  • To all interested contributors

Current Tags

  • 0.3.2                                ...           latest (10 months ago)

8 Versions

  • 0.3.2                                ...           10 months ago
  • 0.3.1                                ...           10 months ago
  • 0.3.0                                ...           10 months ago
  • 0.2.3                                ...           10 months ago
  • 0.2.2                                ...           10 months ago
  • 0.2.1                                ...           10 months ago
  • 0.2.0                                ...           10 months ago
  • 0.1.0                                ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (9)
Dependents (1)

Copyright 2014 - 2016 © taobao.org |