Open Kangaroux opened 7 years ago
Would be nice to have an optional default parameter for the get function. If the cookie is undefined then the default would be returned instead.
default
var c = Cookies.get("some-cookie"); if(typeof c === "undefined") { c = "default value"; }
vs.
var c = Cookies.get("some-cookie", "default value");
Note that the current implementation uses undefined as the default, so there really is no performance hit from doing this.
undefined
https://github.com/ScottHamper/Cookies/blob/master/src/cookies.js#L41
Would be nice to have an optional
default
parameter for the get function. If the cookie is undefined then the default would be returned instead.vs.
Note that the current implementation uses
undefined
as the default, so there really is no performance hit from doing this.https://github.com/ScottHamper/Cookies/blob/master/src/cookies.js#L41