forked from d3/d3
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
18 lines (14 loc) · 674 Bytes
/
index.js
File metadata and controls
18 lines (14 loc) · 674 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
var document = require("jsdom").jsdom(),
globals = {};
// Stash old globals.
if ("d3" in global) globals.d3 = global.d3;
if ("window" in global) globals.window = global.window;
if ("document" in global) globals.document = global.document;
// Set temporary globals to pretend we’re in a browser.
global.window = document.parentWindow;
global.document = document;
module.exports = require("./d3");
// Restore old globals.
if ("d3" in globals) global.d3 = globals.d3; else delete global.d3;
if ("window" in globals) global.window = globals.window; else delete global.window;
if ("document" in globals) global.document = globals.document; else delete global.document;