Handling an unknown number of arguments
function(cb,limit,pattern) {
    limit = typeof(limit) === "undefined" ? 1 : limit;
    //do stuff
}


Calling a function with less arguments than declared will just fill them with undefined. You can then check if that is the value, if so fill in your default ones.
The I have above will have the same affect as yours, there are always three variables (even in your code, Javascript variables are function scope, all of the var declarations are pulled to the top.).
The variables:
cb - unchanged
limit - set to 1 if not supplied
pattern - unchanged (undefined if not supplied)

EDIT:
I just saw your comment on reordering
you can do the following

  function foo(cb,limit,pattern) {
        if(limit instanceof RegExp) {
            pattern = limit;
            limit = 1;
        }
        else {
            limit = typeof(limit) === "undefined" ? 1 : limit;
        }
        //do stuff
    }