Core meteor validation package for checking data, nothing more
meteor add simple-validation
This package provides two helper functions for doing validation:
Validate.check( validator, args... );
Provide a validator and any additional arguments that validator may require
Example:
Validate.check( VadliateIsString, 1 ) === 'Please enter a string';
Validate.chain( checks... );
Provide a series of Validate.check
responses, this will then merge the results
of those checks into an array of messages, or true on success of all checks.
Example:
Validate.chain(
Validate.check(ValidateIsString, 1),
Validate.check(ValidateIsString, 1, 'my message')
) === [ "Please enter a string", "my message" ];
All validators included, and any validators you write should adhere to the following:
- Return true on success.
- Return a string with an appropriate error meessage on failure.
This package comes with 3 validatos for your convenience:
ValidateIsNumeric.validate( data, optionalMessage )
ValidateIsString.validate( data, optionalMessage )
ValidateNotEmpty.validate( data, optionalMessage )
cd src
meteor test-packages ./
cd src
meteor publish