Factory function to define a knockout extender for a given validator function.