Here is the lib: https://github.com/willdurand/CallbackValidator

Test suite is failling because of the edge cases you pointed out.