A simple yet powerful node.js input validation function