11var vows = require ( "vows" ) ,
2- d3 = require ( "../../" ) ,
2+ _ = require ( "../../" ) ,
33 load = require ( "../load" ) ,
44 assert = require ( "../assert" ) ;
55
@@ -13,7 +13,7 @@ suite.addBatch({
1313 . key ( function ( d ) { return d . foo ; } )
1414 . entries ( [ { foo : 1 } , { foo : 1 } , { foo : 2 } ] )
1515 . map ( function ( d ) { return d . key ; } )
16- . sort ( d3 . ascending ) ;
16+ . sort ( _ . ascending ) ;
1717 assert . deepEqual ( keys , [ "1" , "2" ] ) ;
1818 } ,
1919 "each entry is a key-values object, with values in input order" : function ( nest ) {
@@ -27,7 +27,7 @@ suite.addBatch({
2727 } ,
2828 "keys can be sorted using an optional comparator" : function ( nest ) {
2929 var keys = nest ( )
30- . key ( function ( d ) { return d . foo ; } ) . sortKeys ( d3 . descending )
30+ . key ( function ( d ) { return d . foo ; } ) . sortKeys ( _ . descending )
3131 . entries ( [ { foo : 1 } , { foo : 1 } , { foo : 2 } ] )
3232 . map ( function ( d ) { return d . key ; } ) ;
3333 assert . deepEqual ( keys , [ "2" , "1" ] ) ;
@@ -45,7 +45,7 @@ suite.addBatch({
4545 "values can be aggregated using an optional rollup" : function ( nest ) {
4646 var entries = nest ( )
4747 . key ( function ( d ) { return d . foo ; } )
48- . rollup ( function ( values ) { return d3 . sum ( values , function ( d ) { return d . bar ; } ) ; } )
48+ . rollup ( function ( values ) { return _ . sum ( values , function ( d ) { return d . bar ; } ) ; } )
4949 . entries ( [ { foo : 1 , bar : 2 } , { foo : 1 , bar : 0 } , { foo : 1 , bar : 1 } , { foo : 2 } ] ) ;
5050 assert . deepEqual ( entries , [
5151 { key : "1" , values : 3 } ,
@@ -54,8 +54,8 @@ suite.addBatch({
5454 } ,
5555 "multiple key functions can be specified" : function ( nest ) {
5656 var entries = nest ( )
57- . key ( function ( d ) { return d [ 0 ] ; } ) . sortKeys ( d3 . ascending )
58- . key ( function ( d ) { return d [ 1 ] ; } ) . sortKeys ( d3 . ascending )
57+ . key ( function ( d ) { return d [ 0 ] ; } ) . sortKeys ( _ . ascending )
58+ . key ( function ( d ) { return d [ 1 ] ; } ) . sortKeys ( _ . ascending )
5959 . entries ( [ [ 0 , 1 ] , [ 0 , 2 ] , [ 1 , 1 ] , [ 1 , 2 ] , [ 0 , 2 ] ] ) ;
6060 assert . deepEqual ( entries , [
6161 { key : "0" , values : [
@@ -70,8 +70,8 @@ suite.addBatch({
7070 } ,
7171 "the rollup function only applies to leaf values" : function ( nest ) {
7272 var entries = nest ( )
73- . key ( function ( d ) { return d [ 0 ] ; } ) . sortKeys ( d3 . ascending )
74- . key ( function ( d ) { return d [ 1 ] ; } ) . sortKeys ( d3 . ascending )
73+ . key ( function ( d ) { return d [ 0 ] ; } ) . sortKeys ( _ . ascending )
74+ . key ( function ( d ) { return d [ 1 ] ; } ) . sortKeys ( _ . ascending )
7575 . rollup ( function ( values ) { return values . length ; } )
7676 . entries ( [ [ 0 , 1 ] , [ 0 , 2 ] , [ 1 , 1 ] , [ 1 , 2 ] , [ 0 , 2 ] ] ) ;
7777 assert . deepEqual ( entries , [
@@ -87,8 +87,8 @@ suite.addBatch({
8787 } ,
8888 "the value comparator only applies to leaf values" : function ( nest ) {
8989 var entries = nest ( )
90- . key ( function ( d ) { return d [ 0 ] ; } ) . sortKeys ( d3 . ascending )
91- . key ( function ( d ) { return d [ 1 ] ; } ) . sortKeys ( d3 . ascending )
90+ . key ( function ( d ) { return d [ 0 ] ; } ) . sortKeys ( _ . ascending )
91+ . key ( function ( d ) { return d [ 1 ] ; } ) . sortKeys ( _ . ascending )
9292 . sortValues ( function ( a , b ) { return a [ 2 ] - b [ 2 ] ; } )
9393 . entries ( [ [ 0 , 1 ] , [ 0 , 2 , 1 ] , [ 1 , 1 ] , [ 1 , 2 ] , [ 0 , 2 , 0 ] ] ) ;
9494 assert . deepEqual ( entries , [
@@ -104,8 +104,8 @@ suite.addBatch({
104104 } ,
105105 "the key comparator only applies to the last-specified key" : function ( nest ) {
106106 var entries = nest ( )
107- . key ( function ( d ) { return d [ 0 ] ; } ) . sortKeys ( d3 . ascending )
108- . key ( function ( d ) { return d [ 1 ] ; } ) . sortKeys ( d3 . descending )
107+ . key ( function ( d ) { return d [ 0 ] ; } ) . sortKeys ( _ . ascending )
108+ . key ( function ( d ) { return d [ 1 ] ; } ) . sortKeys ( _ . descending )
109109 . entries ( [ [ 0 , 1 ] , [ 0 , 2 ] , [ 1 , 1 ] , [ 1 , 2 ] , [ 0 , 2 ] ] ) ;
110110 assert . deepEqual ( entries , [
111111 { key : "0" , values : [
@@ -118,8 +118,8 @@ suite.addBatch({
118118 ] }
119119 ] ) ;
120120 var entries = nest ( )
121- . key ( function ( d ) { return d [ 0 ] ; } ) . sortKeys ( d3 . descending )
122- . key ( function ( d ) { return d [ 1 ] ; } ) . sortKeys ( d3 . ascending )
121+ . key ( function ( d ) { return d [ 0 ] ; } ) . sortKeys ( _ . descending )
122+ . key ( function ( d ) { return d [ 1 ] ; } ) . sortKeys ( _ . ascending )
123123 . entries ( [ [ 0 , 1 ] , [ 0 , 2 ] , [ 1 , 1 ] , [ 1 , 2 ] , [ 0 , 2 ] ] ) ;
124124 assert . deepEqual ( entries , [
125125 { key : "1" , values : [
@@ -164,7 +164,7 @@ suite.addBatch({
164164 "values can be aggregated using an optional rollup" : function ( nest ) {
165165 var map = nest ( )
166166 . key ( function ( d ) { return d . foo ; } )
167- . rollup ( function ( values ) { return d3 . sum ( values , function ( d ) { return d . bar ; } ) ; } )
167+ . rollup ( function ( values ) { return _ . sum ( values , function ( d ) { return d . bar ; } ) ; } )
168168 . map ( [ { foo : 1 , bar : 2 } , { foo : 1 , bar : 0 } , { foo : 1 , bar : 1 } , { foo : 2 } ] ) ;
169169 assert . deepEqual ( map , {
170170 "1" : 3 ,
@@ -173,8 +173,8 @@ suite.addBatch({
173173 } ,
174174 "multiple key functions can be specified" : function ( nest ) {
175175 var map = nest ( )
176- . key ( function ( d ) { return d [ 0 ] ; } ) . sortKeys ( d3 . ascending )
177- . key ( function ( d ) { return d [ 1 ] ; } ) . sortKeys ( d3 . ascending )
176+ . key ( function ( d ) { return d [ 0 ] ; } ) . sortKeys ( _ . ascending )
177+ . key ( function ( d ) { return d [ 1 ] ; } ) . sortKeys ( _ . ascending )
178178 . map ( [ [ 0 , 1 ] , [ 0 , 2 ] , [ 1 , 1 ] , [ 1 , 2 ] , [ 0 , 2 ] ] ) ;
179179 assert . deepEqual ( map , {
180180 "0" : {
@@ -189,8 +189,8 @@ suite.addBatch({
189189 } ,
190190 "the rollup function only applies to leaf values" : function ( nest ) {
191191 var map = nest ( )
192- . key ( function ( d ) { return d [ 0 ] ; } ) . sortKeys ( d3 . ascending )
193- . key ( function ( d ) { return d [ 1 ] ; } ) . sortKeys ( d3 . ascending )
192+ . key ( function ( d ) { return d [ 0 ] ; } ) . sortKeys ( _ . ascending )
193+ . key ( function ( d ) { return d [ 1 ] ; } ) . sortKeys ( _ . ascending )
194194 . rollup ( function ( values ) { return values . length ; } )
195195 . map ( [ [ 0 , 1 ] , [ 0 , 2 ] , [ 1 , 1 ] , [ 1 , 2 ] , [ 0 , 2 ] ] ) ;
196196 assert . deepEqual ( map , {
@@ -206,8 +206,8 @@ suite.addBatch({
206206 } ,
207207 "the value comparator only applies to leaf values" : function ( nest ) {
208208 var map = nest ( )
209- . key ( function ( d ) { return d [ 0 ] ; } ) . sortKeys ( d3 . ascending )
210- . key ( function ( d ) { return d [ 1 ] ; } ) . sortKeys ( d3 . ascending )
209+ . key ( function ( d ) { return d [ 0 ] ; } ) . sortKeys ( _ . ascending )
210+ . key ( function ( d ) { return d [ 1 ] ; } ) . sortKeys ( _ . ascending )
211211 . sortValues ( function ( a , b ) { return a [ 2 ] - b [ 2 ] ; } )
212212 . map ( [ [ 0 , 1 ] , [ 0 , 2 , 1 ] , [ 1 , 1 ] , [ 1 , 2 ] , [ 0 , 2 , 0 ] ] ) ;
213213 assert . deepEqual ( map , {
@@ -234,7 +234,7 @@ suite.addBatch({
234234 "a custom map implementation can be specified" : function ( nest ) {
235235 var map = nest ( )
236236 . key ( String )
237- . map ( [ "hasOwnProperty" , "__proto__" ] , d3 . map ) ;
237+ . map ( [ "hasOwnProperty" , "__proto__" ] , _ . map ) ;
238238 assert . deepEqual ( map . entries ( ) , [
239239 { key : "hasOwnProperty" , value : [ "hasOwnProperty" ] } ,
240240 { key : "__proto__" , value : [ "__proto__" ] }
@@ -244,7 +244,7 @@ suite.addBatch({
244244 var map = nest ( )
245245 . key ( function ( d ) { return d . foo ; } )
246246 . key ( function ( d ) { return d . bar ; } )
247- . map ( [ { foo : 42 , bar : "red" } ] , d3 . map ) ;
247+ . map ( [ { foo : 42 , bar : "red" } ] , _ . map ) ;
248248 assert . deepEqual ( map . keys ( ) , [ "42" ] ) ;
249249 assert . deepEqual ( map . get ( "42" ) . keys ( ) , [ "red" ] ) ;
250250 assert . deepEqual ( map . get ( "42" ) . values ( ) , [ [ { foo : 42 , bar : "red" } ] ] ) ;
0 commit comments