Rather than defining these two objects as variables here, I think it would be better to pass the object literals directly to the function. As it is there is too much separation between where they are defined and where they are used.