Closed
Description
I think this will be in the best interest for all db users and it'll prevent errors with some nested levels that may be using dots in their keys. I said "/" to copy firebase behaviour .ref('posts/' + postId + '/starCount')
It'll be nice for 1.0.
Ex in Database.get(point) :
function get(point) {
if(point && typeof(point) === 'string') {
var tree = point.split('.'),
parent = goblin.db;
for (var i = 0; i < tree.length; i++) {
if(i !== tree.length-1) {
if(typeof parent[tree[i]] === 'undefined') {
// If there is no child here, won't be deeper. Return undefined
return undefined;
}
parent = parent[tree[i]];
} else {
return parent[tree[i]];
}
}
} else {
return goblin.db;
}
}
Activity
CodingCarlos commentedon Feb 19, 2018
Cool. I used
.
because I've just wanted it to work. We could even move the nesting character to a configurable setting and set the default to/
to be more friendly to firebase syntax.Sediug commentedon Feb 19, 2018
Cool. Agree .
Sediug commentedon Feb 19, 2018
If we all agree I'd say this may be a good feature to have in https://github.com/GoblinDBRocks/GoblinDB/milestone/3
Merge pull request #42 from trigoporres/master