Skip to content

Commit d229606

Browse files
committed
enable multiple reverse results when no types or limit specified
1 parent 6a88b7f commit d229606

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,8 @@ MapboxGeocoder.prototype = {
692692

693693
config = extend(config,
694694
this.options.version === 'v6' ? { longitude: coords[0], latitude: coords[1]} : { query: coords },
695-
!config.types || config.types.length !== 1 ? {limit: 1 } : {}
695+
!config.types && config.limit && config.limit !== 1 ? {limit: 1} : {}, // force limit=1 if no types and limit > 1
696+
config.types && config.types.length !== 1 ? {limit: 1 } : {} // force limit=1 if multiple types
696697
);
697698
} break;
698699
case GEOCODE_REQUEST_TYPE.FORWARD: {

0 commit comments

Comments
 (0)