API change suggestion on set(key, value[, clobber=true])
elmasse opened this issue · 3 comments
Just a small thing, and you don't have to agree with me but, I consider that in these cases it would be more readable an API with a third param as an options object like:
set(key, value[, {clobber: true}]);
since when in code you know what that false/true means:
c.set('a-HEADER', 'more', {clobber: false});
What do you think?
It just feels a little weird to have an options object when there is only one option. I'm trying to think of another case where we might need an option though.
@mikeal while I agree that it feels weird I think it is a positive change in terms of code readability. I, as most developers, read docs when I'm trying to use a certain feature, but when reading someone else's code I usually guess by the API what the method is doing.
So, in this particular case, I would expect a key, value params in a setter method, but a third param as boolean is not intuitive at all.
So, just my two cents, feel free to close this issue if you think it is useless.
Best,
Max
hrm... i think you're right, i just need to think about the best way to do this without breaking API or killing performance.