@@ -78,15 +78,10 @@ export function inferChannelScale(name, channel) {
7878// computed; i.e., if the scale’s domain is set explicitly, that takes priority
7979// over the sort option, and we don’t need to do additional work.
8080export function channelDomain ( data , facets , channels , facetChannels , options ) {
81+ const { order : defaultOrder , reverse : defaultReverse , reduce : defaultReduce = true , limit : defaultLimit } = options ;
8182 for ( const x in options ) {
8283 if ( ! registry . has ( x ) ) continue ; // ignore unknown scale keys (including generic options)
83- let {
84- value : y ,
85- order = options . order ,
86- reverse = options . reverse ,
87- reduce = options . reduce === undefined ? true : options . reduce ,
88- limit = options . limit
89- } = maybeValue ( options [ x ] ) ;
84+ let { value : y , order = defaultOrder , reverse = defaultReverse , reduce = defaultReduce , limit = defaultLimit } = maybeValue ( options [ x ] ) ; // prettier-ignore
9085 order = order === undefined ? y === "width" || y === "height" ? descendingGroup : ascendingGroup : maybeOrder ( order ) ; // prettier-ignore
9186 if ( reduce == null || reduce === false ) continue ; // disabled reducer
9287 const X = x === "fx" || x === "fy" ? reindexFacetChannel ( facets , facetChannels [ x ] ) : findScaleChannel ( channels , x ) ;
@@ -161,7 +156,7 @@ function values(channels, name, alias) {
161156}
162157
163158function maybeOrder ( order ) {
164- if ( typeof order === "function" ) return order ;
159+ if ( order == null || typeof order === "function" ) return order ;
165160 switch ( `${ order } ` . toLowerCase ( ) ) {
166161 case "ascending" :
167162 return ascendingGroup ;
0 commit comments