Skip to content

Commit 344f1fb

Browse files
committed
sorted parameter defaults to true if not set
1 parent 837efa8 commit 344f1fb

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/ParseQuery.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1101,11 +1101,12 @@ class ParseQuery {
11011101
* @param {Number} maxDistance Maximum distance (in radians) of results to
11021102
* return.
11031103
* @param {Boolean} sorted A Bool value that is true if results should be
1104-
* sorted by distance ascending, false is no sorting is required.
1104+
* sorted by distance ascending, false is no sorting is required,
1105+
* defaults to true.
11051106
* @return {Parse.Query} Returns the query, so you can chain this call.
11061107
*/
11071108
withinRadians(key: string, point: ParseGeoPoint, distance: number, sorted: boolean): ParseQuery {
1108-
if (sorted) {
1109+
if (sorted || sorted === undefined) {
11091110
this.near(key, point);
11101111
return this._addCondition(key, '$maxDistance', distance);
11111112
} else {
@@ -1122,7 +1123,8 @@ class ParseQuery {
11221123
* @param {Number} maxDistance Maximum distance (in miles) of results to
11231124
* return.
11241125
* @param {Boolean} sorted A Bool value that is true if results should be
1125-
* sorted by distance ascending, false is no sorting is required.
1126+
* sorted by distance ascending, false is no sorting is required,
1127+
* defaults to true.
11261128
* @return {Parse.Query} Returns the query, so you can chain this call.
11271129
*/
11281130
withinMiles(key: string, point: ParseGeoPoint, distance: number, sorted: boolean): ParseQuery {
@@ -1138,7 +1140,8 @@ class ParseQuery {
11381140
* @param {Number} maxDistance Maximum distance (in kilometers) of results
11391141
* to return.
11401142
* @param {Boolean} sorted A Bool value that is true if results should be
1141-
* sorted by distance ascending, false is no sorting is required.
1143+
* sorted by distance ascending, false is no sorting is required,
1144+
* defaults to true.
11421145
* @return {Parse.Query} Returns the query, so you can chain this call.
11431146
*/
11441147
withinKilometers(key: string, point: ParseGeoPoint, distance: number, sorted: boolean): ParseQuery {

0 commit comments

Comments
 (0)