The _getExetendedOptions refactor is definitely a reasonable change, but the _getExpiresDate refactor causes a unit test to fail. Having now as a function argument allows for dependency injection of the current Date, which is necessary for automated testing. It is admittedly not ideal to have code which sole purpose is to cater to unit testing, but I'd rather that then not be able to test the function entirely.
In any case, at some point I may get around to a complete refactoring of the library in TypeScript/ES6. It's been on my mind. Until then, I'm only really interested in fixing any bugs that crop up.
Regardless, thank you for checking out the library!
Hey @Xuefeng-Zhu ,
The
_getExetendedOptions
refactor is definitely a reasonable change, but the_getExpiresDate
refactor causes a unit test to fail. Havingnow
as a function argument allows for dependency injection of the current Date, which is necessary for automated testing. It is admittedly not ideal to have code which sole purpose is to cater to unit testing, but I'd rather that then not be able to test the function entirely.In any case, at some point I may get around to a complete refactoring of the library in TypeScript/ES6. It's been on my mind. Until then, I'm only really interested in fixing any bugs that crop up.
Regardless, thank you for checking out the library!