Core
Returns an object with helpful methods that will call a validation library to validate values.
How each method behaves depends on the chosen shim and validation library.
validate.register(LIBRARY_NAME, MAP_OF_METHODS)
The MAP_OF_METHODS
consists of three methods that define the three main uses cases, validate many, validate one, and check one.
Demo
Initialization
var validate = require('can-validate-legacy');
// Validation library
require('validate.js');
// Shim for library
require('can-validate-legacy/shims/validatejs');
The key initializing part is the shim. The shim will define how the can-validate methods behave and will also define the necessary parameters.
Registering a Shim
If a new shim is needed, it must first be register itself with can-validate.