Skip to content

Add default value to Cookies.get#77

Open
baca130 wants to merge 1 commit intoScottHamper:masterfrom
baca130:patch-2
Open

Add default value to Cookies.get#77
baca130 wants to merge 1 commit intoScottHamper:masterfrom
baca130:patch-2

Conversation

@baca130
Copy link

@baca130 baca130 commented Jan 9, 2018

Cookies.get("name") - if "name" not exist return undefined
Cookies.get("name", 7) - if "name" not exist return 7

Cookies.get("name") - if "name" not exist return undefined
Cookies.get("name", 7)   - if "name" not exist return 7
var value = Cookies._cache[Cookies._cacheKeyPrefix + key];

return value === undefined ? undefined : decodeURIComponent(value);
return value === def ? undefined : decodeURIComponent(value);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrong placed def

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants