I've found that if localstorage is not available and this code falls back to cookie solution. in that case it always goes wrong. here it is how it goes wrong.
If used once like
$.localStorage('fbloginresult', null);
This will set the cookie expires option to -1. From going forward it always set to -1
You see that this.removeItem is extending the cookieOptions and changing the original options passed to the calling method. Hence when it calls the this.setItem after this.removeItem the cookie options are now changed and always passed expiry as -1
I've found that if localstorage is not available and this code falls back to cookie solution. in that case it always goes wrong. here it is how it goes wrong.
If used once like
This will set the cookie expires option to -1. From going forward it always set to -1
File Code
You see that this.removeItem is extending the cookieOptions and changing the original options passed to the calling method. Hence when it calls the this.setItem after this.removeItem the cookie options are now changed and always passed expiry as -1
So this.removeItem should be like this.
So that it should not extend the original options passed to this function.