I'll like to see if there is a name(it's a bad practice?) for this:
var callback = function(error, data) {
var method = error ? 'handleError' : 'handleSuccess';
object[method](error || data, action);
};
If there's an error, object.handleError will use error and action, let say I dont care about any other param after error if error
In the other hand, if there's no error, object.handleSuccess will use data and action