Validate Plugin

Back to plugins | Download plugin

The Validate plugin adds a method to the API wrapper which provides validation of multiple data types.

The validate() method accepts 4 arguments, of which only the first is required:

  nano('input').validate('string', null, 5, 12);

This would check that the text in "input" is a string, and that it is between 5 and 12 characters in length.

Validation Types

By default, the validate() method checks that the value is not null, undefined, 0, '0', '' or false. The available validation types are: