@@ -3,10 +3,17 @@ return dc;}
3
3
if ( typeof define === "function" && define . amd ) {
4
4
define ( [ "d3" , "crossfilter" ] , _dc ) ;
5
5
} else if ( typeof module === "object" && module . exports ) {
6
- // When using window global, window.crossfilter is a function
7
- // When using require, the value will be an object with 'crossfilter'
8
- // field, so we need to access it here.
9
- module . exports = _dc ( require ( 'd3' ) , require ( 'crossfilter' ) . crossfilter ) ;
6
+ var _d3 = require ( 'd3' ) ;
7
+ var _crossfilter = require ( 'crossfilter' ) ;
8
+ // When using npm + browserify, 'crossfilter' is a function,
9
+ // since package.json specifies index.js as main function, and it
10
+ // does special handling. When using bower + browserify,
11
+ // there's no main in bower.json (in fact, there's no bower.json),
12
+ // so we need to fix it.
13
+ if ( typeof _crossfilter !== "function" ) {
14
+ _crossfilter = _crossfilter . crossfilter ;
15
+ }
16
+ module . exports = _dc ( _d3 , _crossfilter ) ;
10
17
} else {
11
18
this . dc = _dc ( d3 , crossfilter ) ;
12
19
}
0 commit comments