You have to decide as which parameter you want to treat a single argument. You cannot treat it as both, content and options.
I see two possibilities:
- Either change the order of your arguments, i.e.
function(options, content) -
Check whether
optionsis defined:function(content, options) { if(typeof options === "undefined") { options = content; content = null; } //action }But then you have to document properly, what happens if you only pass one argument to the function, as this is not immediately clear by looking at the signature.