Skip to content

Commit 0349b61

Browse files
authored
Merge pull request #139 from chaitanya0bhagvan/master
forEach and map method on the DataSnapshot does not retain key
2 parents da34c79 + 80133de commit 0349b61

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: lib/modules/database.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class DataSnapshot {
3535

3636
forEach(fn) {
3737
(this.childKeys || [])
38-
.forEach(key => fn(this.value[key]))
38+
.forEach(key => fn({key: key, value: this.value[key]}))
3939
}
4040

4141
map(fn) {
@@ -233,7 +233,7 @@ class DatabaseRef extends ReferenceBase {
233233
const path = this.dbPath();
234234
return this.db.off(path, evt, origCB)
235235
.then(({callback, subscriptions}) => {
236-
if (dbSubscriptions[path] && dbSubscriptions[path][evt].length > 0) {
236+
if (dbSubscriptions[path] && dbSubscriptions[path][evt] && dbSubscriptions[path][evt].length > 0) {
237237
return subscriptions;
238238
}
239239

0 commit comments

Comments
 (0)