Skip to content

Commit 4b31ba5

Browse files
authored
Merge pull request #55 from AddSearch/sc-8498/reference-error-document
[sc-8498] check typeof document
2 parents 0de646f + 57ea131 commit 4b31ba5

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

dist/addsearch-js-client.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "addsearch-js-client",
3-
"version": "0.8.6",
3+
"version": "0.8.7",
44
"description": "AddSearch API JavaScript client",
55
"main": "index.js",
66
"jsdelivr": "./dist/addsearch-js-client.min.js",

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)