@@ -25,20 +25,20 @@ test('Index', function (t) {
2525 'new Index(keyFn)'
2626 )
2727
28- instance = new Index ( tree , 'id' )
28+ instance = new Index ( 'id' , tree )
2929
3030 t . deepEqual (
3131 [ instance instanceof Index , instance . get ( 1 ) ] ,
3232 [ true , [ node , alt ] ] ,
33- 'new Index(tree, prop )'
33+ 'new Index(prop, tree )'
3434 )
3535
36- instance = new Index ( tree , filter , 'id' )
36+ instance = new Index ( 'id' , tree , filter )
3737
3838 t . deepEqual (
3939 [ instance instanceof Index , instance . get ( 1 ) ] ,
4040 [ true , [ node ] ] ,
41- 'new Index(tree, filter, prop )'
41+ 'new Index(prop, tree, filter )'
4242 )
4343
4444 t . end ( )
@@ -56,7 +56,7 @@ test('index.add', function (t) {
5656 var ast = u ( 'root' , [ u ( 'node' , { word : 'foo' } ) , u ( 'node' , { word : 'bar' } ) ] )
5757 var extraNode = u ( 'node' , { word : 'foo' } )
5858
59- var index = new Index ( ast , 'word' )
59+ var index = new Index ( 'word' , ast )
6060 t . deepEqual ( index . get ( 'foo' ) , [ select ( '[word=foo]' , ast ) ] )
6161
6262 var result = index . add ( extraNode )
@@ -98,7 +98,7 @@ test('index.get', function (t) {
9898 ] )
9999 ] )
100100
101- var index = new Index ( ast , 'color' )
101+ var index = new Index ( 'color' , ast )
102102
103103 st . deepEqual ( index . get ( 'black' ) , [
104104 select ( '[id=0]' , ast ) ,
@@ -132,7 +132,7 @@ test('index.get', function (t) {
132132 u ( 'node' , { word : 'constructor' , id : 1 } ) ,
133133 u ( 'node' , { word : 'toString' , id : 2 } )
134134 ] )
135- var index = new Index ( ast , 'word' )
135+ var index = new Index ( 'word' , ast )
136136
137137 sst . deepEqual ( index . get ( '__proto__' ) , [ select ( '[id=0]' , ast ) ] )
138138 sst . deepEqual ( index . get ( 'constructor' ) , [ select ( '[id=1]' , ast ) ] )
@@ -151,7 +151,7 @@ test('index.get', function (t) {
151151 u ( 'node' , { word : id1 , id : 4 } ) ,
152152 u ( 'node' , { word : id2 , id : 5 } )
153153 ] )
154- var index = new Index ( ast , 'word' )
154+ var index = new Index ( 'word' , ast )
155155
156156 sst . deepEqual ( index . get ( false ) , [ select ( '[id=0]' , ast ) ] )
157157 sst . deepEqual ( index . get ( 'false' ) , [ select ( '[id=1]' , ast ) ] )
@@ -167,7 +167,7 @@ test('index.get', function (t) {
167167 } )
168168
169169 t . test ( 'empty index' , function ( st ) {
170- st . deepEqual ( new Index ( null , 'foo' ) . get ( 'bar' ) , [ ] )
170+ st . deepEqual ( new Index ( 'foo' , null ) . get ( 'bar' ) , [ ] )
171171 st . deepEqual ( new Index ( 'foo' ) . get ( 'bar' ) , [ ] )
172172 st . end ( )
173173 } )
@@ -181,14 +181,14 @@ test('index.get', function (t) {
181181 ] )
182182
183183 st . test ( 'type test' , function ( sst ) {
184- var index = new Index ( ast , 'node ', 'word ')
184+ var index = new Index ( 'word ', ast , 'node ')
185185 sst . deepEqual ( index . get ( 'foo' ) , [ select ( 'node[word="foo"]' , ast ) ] )
186186 sst . deepEqual ( index . get ( 'bar' ) , [ select ( 'node[word="bar"]' , ast ) ] )
187187 sst . end ( )
188188 } )
189189
190190 st . test ( 'function test' , function ( sst ) {
191- var index = new Index ( ast , filter , 'word' )
191+ var index = new Index ( 'word' , ast , filter )
192192 sst . deepEqual ( index . get ( 'foo' ) , [ select ( 'node[word="foo"]' , ast ) ] )
193193 sst . deepEqual ( index . get ( 'bar' ) , [ select ( 'node[word="bar"]' , ast ) ] )
194194 sst . end ( )
@@ -210,7 +210,7 @@ test('index.get', function (t) {
210210 ] )
211211 var index
212212
213- index = new Index ( ast , xPlusY )
213+ index = new Index ( xPlusY , ast )
214214 st . deepEqual ( index . get ( 4 ) , [
215215 select ( '[id=0]' , ast ) ,
216216 select ( '[id=2]' , ast ) ,
@@ -219,7 +219,7 @@ test('index.get', function (t) {
219219 st . deepEqual ( index . get ( 0 ) , [ ] )
220220 st . deepEqual ( index . get ( 5 ) , [ select ( '[id=1]' , ast ) , select ( '[id=4]' , ast ) ] )
221221
222- st . deepEqual ( new Index ( ast , 'node' , xPlusY ) . get ( 4 ) , [
222+ st . deepEqual ( new Index ( xPlusY , ast , 'node' ) . get ( 4 ) , [
223223 select ( '[id=2]' , ast ) ,
224224 select ( '[id=3]' , ast )
225225 ] )
@@ -241,7 +241,7 @@ test('index.remove', function (t) {
241241 u ( 'node' , { word : 'bar' } )
242242 ] )
243243
244- var index = new Index ( ast , 'word' )
244+ var index = new Index ( 'word' , ast )
245245 t . deepEqual ( index . get ( 'foo' ) , [
246246 select ( 'bad[word=foo]' , ast ) ,
247247 select ( 'node[word=foo]' , ast )
0 commit comments