Update validator.js

refactor validation object creation