refactored lib/waterline/core/validations.js for better performance and readability