Skip to content

Commit 52e93c0

Browse files
committed
Move things around and rename log statement
1 parent adee19e commit 52e93c0

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

src/index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
const isBrowser =
22
typeof window !== "undefined" && typeof window.document !== "undefined";
33

4-
const isWebWorker =
5-
typeof self === "object" &&
6-
self.constructor &&
7-
self.constructor.name === "DedicatedWorkerGlobalScope";
8-
94
const isNode =
105
typeof process !== "undefined" &&
116
process.versions != null &&
127
process.versions.node != null;
138

9+
const isWebWorker =
10+
typeof self === "object" &&
11+
self.constructor &&
12+
self.constructor.name === "DedicatedWorkerGlobalScope";
13+
1414
/**
1515
* @see https://github.com/jsdom/jsdom/releases/tag/12.0.0
1616
* @see https://github.com/jsdom/jsdom/issues/1537

test/index.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import { assert } from "chai";
2-
import { isBrowser, isWebBrowser, isNode, isDeno, isJsDom } from "../src";
2+
import { isBrowser, isNode, isWebWorker, isDeno, isJsDom } from "../src";
33

4-
console.log("Browser?", isBrowser);
5-
console.log("Node?", isNode);
6-
console.log("Web browser?", isWebBrowser);
7-
console.log("JS Dom?", isJsDom);
8-
console.log("Deno?", isDeno);
4+
console.log({
5+
isBrowser,
6+
isNode,
7+
isWebWorker,
8+
isJsDom,
9+
isDeno,
10+
});
911

1012
describe("Browser or Node.js", () => {
1113
it("should check node env", () => {

test/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Special check for isDeno
22
// Run with `deno run test/index.ts`
3-
import { isDeno } from '../src/index.js';
3+
import { isDeno } from "../src/index.js";
44

5-
console.log(isDeno);
5+
console.log({ isDeno });

0 commit comments

Comments
 (0)