diff --git a/lib/modules/database.js b/lib/modules/database.js index 5c4b27e..1112919 100644 --- a/lib/modules/database.js +++ b/lib/modules/database.js @@ -35,7 +35,7 @@ class DataSnapshot { forEach(fn) { (this.childKeys || []) - .forEach(key => fn(this.value[key])) + .forEach(key => fn({key: key, value: this.value[key]})) } map(fn) { @@ -232,7 +232,7 @@ class DatabaseRef extends ReferenceBase { const path = this.dbPath(); return this.db.off(path, evt, origCB) .then(({callback, subscriptions}) => { - if (dbSubscriptions[path] && dbSubscriptions[path][evt].length > 0) { + if (dbSubscriptions[path] && dbSubscriptions[path][evt] && dbSubscriptions[path][evt].length > 0) { return subscriptions; }