Skip to content

Commit

Permalink
Allow accesing children in data snapshot by numbered array index
Browse files Browse the repository at this point in the history
  • Loading branch information
rhodgkins committed Oct 22, 2018
1 parent 42b9086 commit 9eb10b9
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/snapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ function MockDataSnapshot (ref, data, priority) {
}

MockDataSnapshot.prototype.child = function (path) {
if (typeof path === 'number') path = String(path);
// Strip leading or trailing /
path = path.replace(/^\/|\/$/g, '');
var ref = this.ref.child(path);
Expand Down

0 comments on commit 9eb10b9

Please sign in to comment.