I think making it an object has made the code unnecessarily complicated. I think you could almost 1/2 code with a simple function.
This is where I personally think javascript programming is going wrong at the moment, so much boiler plate.
You're also programming a bit too defensively. Ask yourself, do you honestly need all those checks? What would actually happen if you got rid of the checks? I think your code would be clearer without them and the programmer would still realize he'd made a mistake and passed in nulls.
This is where I personally think javascript programming is going wrong at the moment, so much boiler plate.
You're also programming a bit too defensively. Ask yourself, do you honestly need all those checks? What would actually happen if you got rid of the checks? I think your code would be clearer without them and the programmer would still realize he'd made a mistake and passed in nulls.