Skip to content
This repository was archived by the owner on Apr 4, 2023. It is now read-only.

Commit 242cfd1

Browse files
Merge pull request #444 from Websix/master
Updated how options.*.value is checked to allow booleans and numbers
2 parents e0bad8a + bf1da0c commit 242cfd1

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

firebase.android.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1544,7 +1544,7 @@ firebase.query = function (updateCallback, path, options) {
15441544
} else if (options.orderBy.type === firebase.QueryOrderByType.PRIORITY) {
15451545
query = firebase.instance.child(path).orderByPriority();
15461546
} else if (options.orderBy.type === firebase.QueryOrderByType.CHILD) {
1547-
if (!options.orderBy.value) {
1547+
if (options.orderBy.value === undefined || options.orderBy.value === null) {
15481548
reject("When orderBy.type is 'child' you must set orderBy.value as well.");
15491549
return;
15501550
}
@@ -1556,7 +1556,7 @@ firebase.query = function (updateCallback, path, options) {
15561556

15571557
// range
15581558
if (options.range && options.range.type) {
1559-
if (!options.range.value) {
1559+
if (options.range.value === undefined || options.range.value === null) {
15601560
reject("Please set range.value");
15611561
return;
15621562
}
@@ -1576,7 +1576,7 @@ firebase.query = function (updateCallback, path, options) {
15761576
if (options.ranges) {
15771577
for (var i=0; i < options.ranges.length; i++) {
15781578
var range = options.ranges[i];
1579-
if (!range.value) {
1579+
if (range.value === undefined || range.value === null) {
15801580
reject("Please set ranges["+i+"].value");
15811581
return;
15821582
}
@@ -1595,7 +1595,7 @@ firebase.query = function (updateCallback, path, options) {
15951595

15961596
// limit
15971597
if (options.limit && options.limit.type) {
1598-
if (!options.limit.value) {
1598+
if (options.limit.value === undefined || options.limit.value === null) {
15991599
reject("Please set limit.value");
16001600
return;
16011601
}

firebase.ios.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1594,7 +1594,7 @@ firebase.query = function (updateCallback, path, options) {
15941594
} else if (options.orderBy.type === firebase.QueryOrderByType.PRIORITY) {
15951595
query = where.queryOrderedByPriority();
15961596
} else if (options.orderBy.type === firebase.QueryOrderByType.CHILD) {
1597-
if (!options.orderBy.value) {
1597+
if (options.orderBy.value === undefined || options.orderBy.value === null) {
15981598
reject("When orderBy.type is 'child' you must set orderBy.value as well.");
15991599
return;
16001600
}
@@ -1606,7 +1606,7 @@ firebase.query = function (updateCallback, path, options) {
16061606

16071607
// range
16081608
if (options.range && options.range.type) {
1609-
if (!options.range.value) {
1609+
if (options.range.value === undefined || options.range.value === null) {
16101610
reject("Please set range.value");
16111611
return;
16121612
}
@@ -1626,7 +1626,7 @@ firebase.query = function (updateCallback, path, options) {
16261626
if (options.ranges) {
16271627
for (var i=0; i < options.ranges.length; i++) {
16281628
var range = options.ranges[i];
1629-
if (!range.value) {
1629+
if (range.value === undefined || range.value === null) {
16301630
reject("Please set ranges["+i+"].value");
16311631
return;
16321632
}
@@ -1645,7 +1645,7 @@ firebase.query = function (updateCallback, path, options) {
16451645

16461646
// limit
16471647
if (options.limit && options.limit.type) {
1648-
if (!options.limit.value) {
1648+
if (options.limit.value === undefined || options.limit.value === null) {
16491649
reject("Please set limit.value");
16501650
return;
16511651
}

0 commit comments

Comments
 (0)