Skip to content

Commit

Permalink
Fix global undefined error in browser (#433)
Browse files Browse the repository at this point in the history
  • Loading branch information
eXon committed Dec 30, 2023
1 parent dde5cb6 commit b8cd0fe
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/universal-cookie/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ import * as cookie from 'cookie';
import { Cookie, CookieGetOptions } from './types';

export function hasDocumentCookie() {
const testingValue = (global as any).TEST_HAS_DOCUMENT_COOKIE;
const testingValue =
typeof global === 'undefined'
? undefined
: (global as any).TEST_HAS_DOCUMENT_COOKIE;

if (typeof testingValue === 'boolean') {
return testingValue;
}
Expand Down

0 comments on commit b8cd0fe

Please sign in to comment.