Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

‎lib/modules/database.js‎

Lines changed: 2 additions & 2 deletions
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)

AltStyle によって変換されたページ (->オリジナル) /