Force a functions arity in JavaScript