Skip to content

Commit 390439c

Browse files
committed
[sc-8498] check typeof document
1 parent 0de646f commit 390439c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/cookie.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const setCookie = function(cookieName, cookieValue, expireDays) {
2-
if (!document) {
2+
if (typeof document === 'undefined') {
33
return;
44
}
55
const date = new Date();
@@ -9,7 +9,7 @@ const setCookie = function(cookieName, cookieValue, expireDays) {
99
}
1010

1111
const getCookie = function(cookieName) {
12-
if (!document) {
12+
if (typeof document === 'undefined') {
1313
return;
1414
}
1515
let name = cookieName + "=";
@@ -28,7 +28,7 @@ const getCookie = function(cookieName) {
2828
}
2929

3030
const deleteCookie = function(name) {
31-
if (!document) {
31+
if (typeof document === 'undefined') {
3232
return;
3333
}
3434
document.cookie = name +'=; Path=/; Expires=Thu, 01 Jan 2000 00:00:01 GMT;';

0 commit comments

Comments
 (0)