Skip to content

Commit

Permalink
add export
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukas Ochmann committed Jul 17, 2017
1 parent d6775b8 commit 2cd78e2
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions Cookie.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
helpers.chocolateChip = function (cookieName) {
export const chocolateChip = function (cookieName) {
var re = new RegExp(`${cookieName}=([^;]+)`);
var value = re.exec(document.cookie);
var cookie = (value !== null) ? unescape(value[1]) : null;
Expand All @@ -11,10 +11,16 @@ helpers.chocolateChip = function (cookieName) {
return cookie;
};

helpers.cookieDough = function (name, cookieObject, expires, path) {
export const cookieDough = function (name, cookieObject, expires, path) {
document.cookie = `${name}=${JSON.stringify(cookieObject)}; expires=${expires.wDay}, ${expires.date} ${expires.time}; path=${path}`;
};

helpers.cookieCrumb = function (name) {
export const cookieCrumb = function (name) {
document.cookie = `${name}=; expires=Fri, 27 Dec 1996 08:54:00 UTC`;
};

export default {
chocolateChip,
cookieDough,
cookieCrumb,
};

0 comments on commit 2cd78e2

Please sign in to comment.