Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed accessing DataSnapshot with multiple paths #113

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

rhodgkins
Copy link
Contributor

@rhodgkins rhodgkins commented Oct 15, 2018

With this following data snapshot:

{
     foo: {
          bar: 'val'
     }
}

Calling snapshot.child('foo/bar').val() should be val - but as .child (and also .hasChild) just checks this._snapshotdata for the key without splitting it by / it returns null. Includes tests.

Also it would be useful to have this available so code that interacts with DataSnapshots directly (it might merge various snapshots into a single object, etc.) can be tested, so I've exported snapshot.js as DataSnapshot.

Finally I've also added node 8 to the travis test matrix - hope this is ok!

@rhodgkins rhodgkins changed the title Exposed DataSnapshot so it can be used Fixed accessing DataSnapshot with multiple paths Oct 15, 2018
@rhodgkins rhodgkins force-pushed the master branch 2 times, most recently from 881ba39 to fb7ef54 Compare October 15, 2018 11:42
@rhodgkins
Copy link
Contributor Author

I've fixed issue with accessing child data with number paths (for array indexes), including failing test case.

@dmurvihill
Copy link

dmurvihill commented Nov 20, 2019

Hi @rhodgkins, thanks for the contribution. As you may have guessed, this repo is no longer used (see #160), but work is continuing on my fork for now, and we will be making a release in early December. I've opened a new PR with these changes.

(Also, if you still happen to depend on firebase-mock, we are looking for maintainers).

@dmurvihill
Copy link

The sister PR has now been merged. Look for a release soon. Thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants