Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions src/common/providers/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,20 +152,12 @@ export class DataSnapshot implements database.DataSnapshot {
}

/**
* Returns `true` if this `DataSnapshot` contains any data. It is slightly more
* efficient than using `snapshot.val() !== null`.
* Returns `true` if this `DataSnapshot` contains any data.
*
* @return `true` if this `DataSnapshot` contains any data; otherwise, `false`.
*/
exists(): boolean {
const val = this.val();
if (!val || val === null) {
return false;
}
if (typeof val === "object" && Object.keys(val).length === 0) {
return false;
}
return true;
return this.val() !== null;
}

/**
Expand Down