I'm trying to write some js function's validation.
Idea: I have checking function, passing to it checked function object, here make sure that all right (or not). I don't want to pass arguments separately, only function object. How can i reach this?
For now i forced to be content with two parameters for checking function - func obj and func arguments
That is what i want:
function checkFunction(func) {
console.log(func.name);
console.log(func.arguments);
// validate something
}
function checkedFunction(a, b, c) {
checkFunction(checkedFunction...);
// do something
}
That is what i have now:
function checkFunction(func, args) {
console.log(func.name);
console.log(args);
// validate something
}
function checkedFunction(a, b, c) {
checkFunction(checkedFunction, arguments);
// do something;
}