Skip to content

Commit

Permalink
Added example validation plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
notheotherben committed Dec 11, 2013
1 parent eab903d commit b05c566
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions example/StringCaseValidationPlugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
var Database = require('iridium');

var Plugin = {
validate: function(schema, value, propertyName) {
if(schema == 'Uppercase')
return this.assert(value.toUpperCase() == value, 'uppercase string', value);
if(schema == 'Lowercase')
return this.assert(value.toLowerCase() == value, 'lowercase string', value);
}
};

module.exports = Plugin;

0 comments on commit b05c566

Please sign in to comment.