@@ -6,7 +6,7 @@ var inspect = require('object-inspect')
66var uniq = require ( 'lowscore/uniq' )
77var debug = require ( 'debug' ) ( 'browser-monkey' )
88
9- function Selector ( ) {
9+ function Query ( ) {
1010 this . _conditions = [ ]
1111 this . _options = {
1212 visibleOnly : true ,
@@ -75,7 +75,7 @@ function Selector () {
7575 this . _value = undefined
7676}
7777
78- Selector . prototype . action = function ( action ) {
78+ Query . prototype . action = function ( action ) {
7979 return this . clone ( function ( clone ) {
8080 if ( clone . _action ) {
8181 throw new Error ( 'can only have one action' )
@@ -96,7 +96,7 @@ function retryFromOptions (options) {
9696 }
9797}
9898
99- Selector . prototype . mapAll = function ( mapper , description ) {
99+ Query . prototype . mapAll = function ( mapper , description ) {
100100 return this . clone ( function ( clone ) {
101101 clone . _conditions . push ( function ( elements ) {
102102 return {
@@ -107,7 +107,7 @@ Selector.prototype.mapAll = function (mapper, description) {
107107 } )
108108}
109109
110- Selector . prototype . map = function ( mapper , description ) {
110+ Query . prototype . map = function ( mapper , description ) {
111111 return this . clone ( function ( clone ) {
112112 clone . _conditions . push ( function ( elements ) {
113113 return {
@@ -118,7 +118,7 @@ Selector.prototype.map = function (mapper, description) {
118118 } )
119119}
120120
121- Selector . prototype . filter = function ( filter , description ) {
121+ Query . prototype . filter = function ( filter , description ) {
122122 return this . clone ( function ( clone ) {
123123 clone . _conditions . push ( function ( elements ) {
124124 return {
@@ -129,7 +129,7 @@ Selector.prototype.filter = function (filter, description) {
129129 } )
130130}
131131
132- Selector . prototype . all = function ( queryCreators ) {
132+ Query . prototype . all = function ( queryCreators ) {
133133 var self = this
134134
135135 var queries = queryCreators . map ( function ( queryCreator ) {
@@ -154,11 +154,11 @@ Selector.prototype.all = function (queryCreators) {
154154 } )
155155}
156156
157- Selector . prototype . subQuery = function ( createQuery ) {
157+ Query . prototype . subQuery = function ( createQuery ) {
158158 var clone = this . clone ( )
159159 clone . _conditions = [ ]
160160 var query = createQuery ( clone )
161- if ( ! ( query instanceof Selector ) ) {
161+ if ( ! ( query instanceof Query ) ) {
162162 throw new Error ( 'expected to create query: ' + createQuery )
163163 }
164164 return query
@@ -168,7 +168,7 @@ Selector.prototype.resolveSubQuery = function (createQuery, value) {
168168 return this . subQuery ( createQuery ) . resolve ( value )
169169}
170170
171- Selector . prototype . resolve = function ( value , options ) {
171+ Query . prototype . resolve = function ( value , options ) {
172172 var accumulator = { }
173173 var includeScope = options && options . hasOwnProperty ( 'includeScope' ) && options . includeScope !== undefined
174174 ? options . includeScope
@@ -208,7 +208,7 @@ Selector.prototype.resolve = function (value, options) {
208208 }
209209}
210210
211- Selector . prototype . race = function ( queryCreators ) {
211+ Query . prototype . race = function ( queryCreators ) {
212212 var self = this
213213
214214 var queries = queryCreators . map ( function ( queryCreator ) {
@@ -250,7 +250,7 @@ Selector.prototype.race = function (queryCreators) {
250250 } )
251251}
252252
253- Selector . prototype . options = function ( options ) {
253+ Query . prototype . options = function ( options ) {
254254 if ( options ) {
255255 return this . clone ( function ( clone ) {
256256 extend ( clone . _options , options )
@@ -260,7 +260,7 @@ Selector.prototype.options = function (options) {
260260 }
261261}
262262
263- Selector . prototype . then = function ( ) {
263+ Query . prototype . then = function ( ) {
264264 var self = this
265265 var retry = retryFromOptions ( this . _options )
266266 var originalStack = new Error ( ) . stack
@@ -320,7 +320,7 @@ function describeTransform (transform) {
320320 return transform . description + ' ' + v
321321}
322322
323- Selector . prototype . catch = function ( fn ) {
323+ Query . prototype . catch = function ( fn ) {
324324 return this . then ( undefined , fn )
325325}
326326
@@ -335,7 +335,7 @@ function copySelectorFields (from, to) {
335335 } )
336336}
337337
338- Selector . prototype . clone = function ( modifier ) {
338+ Query . prototype . clone = function ( modifier ) {
339339 var clone = new this . constructor ( )
340340 copySelectorFields ( this , clone )
341341 if ( modifier ) {
@@ -344,14 +344,14 @@ Selector.prototype.clone = function (modifier) {
344344 return clone
345345}
346346
347- Selector . prototype . ensure = function ( assertion , name ) {
347+ Query . prototype . ensure = function ( assertion , name ) {
348348 return this . mapAll ( function ( value ) {
349349 assertion ( value )
350350 return value
351351 } , name || 'ensure' )
352352}
353353
354- Selector . prototype . zero = function ( ) {
354+ Query . prototype . zero = function ( ) {
355355 return this . mapAll ( function ( results ) {
356356 if ( results instanceof Array ) {
357357 if ( results . length !== 0 ) {
@@ -365,7 +365,7 @@ Selector.prototype.zero = function () {
365365 } , 'zero' )
366366}
367367
368- Selector . prototype . one = function ( ) {
368+ Query . prototype . one = function ( ) {
369369 return this . mapAll ( function ( results ) {
370370 if ( results instanceof Array ) {
371371 if ( results . length === 1 ) {
@@ -379,7 +379,7 @@ Selector.prototype.one = function () {
379379 } , 'one' )
380380}
381381
382- Selector . prototype . some = function ( ) {
382+ Query . prototype . some = function ( ) {
383383 return this . mapAll ( function ( results ) {
384384 if ( results instanceof Array && results . length !== 0 ) {
385385 return results
@@ -389,13 +389,13 @@ Selector.prototype.some = function () {
389389 } , 'some' )
390390}
391391
392- Selector . prototype . input = function ( value ) {
392+ Query . prototype . input = function ( value ) {
393393 return this . clone ( function ( clone ) {
394394 clone . _value = value
395395 } )
396396}
397397
398- Selector . prototype . component = function ( methods ) {
398+ Query . prototype . component = function ( methods ) {
399399 var self = this
400400
401401 function Component ( ) {
@@ -416,4 +416,4 @@ Selector.prototype.component = function (methods) {
416416 return new Component ( )
417417}
418418
419- module . exports = Selector
419+ module . exports = Query
0 commit comments