@contactable/swv

1.4.0 • Public • Published

Schema-Woven Validation

This is a JavaScript implementation of Schema-Woven Validation (SWV), the next generation of web form validation mechanism.

Installation

npm install @contactable/swv --save

Validating user input based on schema

import { validate } from '@contactable/swv';

// schema: SWV schema object
// formData: FormData object
const result = validate( schema, formData );

for ( const [ field, { error } ] of result ) {
	if ( undefined !== error ) {
		// Add validation error message to the field
	}
}

Readme

Keywords

none

Package Sidebar

Install

npm i @contactable/swv

Weekly Downloads

1

Version

1.4.0

License

MIT

Unpacked Size

33.6 kB

Total Files

35

Last publish

Collaborators

  • takayukister