Skip to content

Commit 6d688d3

Browse files
committed
Convert isJsDom to simple boolean test instead of a method
1 parent 1190c8f commit 6d688d3

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@ const isNode =
1515
* @see https://github.com/jsdom/jsdom/releases/tag/12.0.0
1616
* @see https://github.com/jsdom/jsdom/issues/1537
1717
*/
18-
const isJsDom = (() =>
18+
const isJsDom =
1919
(typeof window !== "undefined" && window.name === "nodejs") ||
20-
navigator.userAgent.includes("Node.js") ||
21-
navigator.userAgent.includes("jsdom"))();
20+
(typeof navigator !== "undefined" &&
21+
(navigator.userAgent.includes("Node.js") ||
22+
navigator.userAgent.includes("jsdom")));
2223

2324
const isDeno = typeof Deno !== "undefined" && typeof Deno.core !== "undefined";
2425

0 commit comments

Comments
 (0)