diff options
author | Phy <git@phy25.com> | 2019-03-13 12:51:32 -0400 |
---|---|---|
committer | Phy <git@phy25.com> | 2019-03-13 12:51:32 -0400 |
commit | bded2f50427c1a29306e13bec420fd7804b75718 (patch) | |
tree | 0c2dbc8d1dcf9dc37ff53cd2cf7f810e3dfed95b /lib/scripts/cookie.js | |
parent | 40be5e7a38c9cf92c115534a77437c3fda53379e (diff) | |
download | dokuwiki-bded2f50427c1a29306e13bec420fd7804b75718.tar.gz dokuwiki-bded2f50427c1a29306e13bec420fd7804b75718.zip |
cookie.js add def parameter to getValue()
Diffstat (limited to 'lib/scripts/cookie.js')
-rw-r--r-- | lib/scripts/cookie.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/scripts/cookie.js b/lib/scripts/cookie.js index a8e90fea5..4fb9c25f7 100644 --- a/lib/scripts/cookie.js +++ b/lib/scripts/cookie.js @@ -38,10 +38,11 @@ var DokuCookie = { * Get a Value from the Cookie * * @author Andreas Gohr <andi@splitbrain.org> + * @param def default value if key does not exist; if not set, returns undefined by default */ - getValue: function(key){ + getValue: function(key, def){ this.init(); - return this.data[key]; + return key in this.data ? this.data[key] : def; }, /** |