Handles optional callbacks in node.js-style functions receiving them.