Factory function for a knockout validator.