node-json-db
node-json-db copied to clipboard
Docs, readme.md, 2 issues
README.md, issues in first example 1) db.push("/test2/my/test/",5); generates an intermittent bug, it might save the value 5 as an unnammed anonymous entry, resulting in:
"test2": {
"my": {
"test": {
"": 5
}
}
OR it might crash, with this error:
this.data[this.parent] = toSet;
^
TypeError: Cannot assign to read only property '' of 5
at DBParentData.setData
One possible fix is to remove the trailing slash
db.push("/test2/my/test",5);
[Which may or may not be what you intend to give as an example ?] Results in
"test2": {
"my": {
"test": 5
}
Then c.a. line 24 should read:
At this point, the results are:
{
"test1": "super test",
"test2": {
"my": {
"test": 5
}
},
"test3": {
"test": "test",
"json": {
"testy": [
"testy"
],
"important": 5
},
"new": "cool"
}
}
I would suggest testing live code and excerpting the results directly into the docs.
Thanks for those correction. I corrected the readme and also made the lib remove any trailing slash (unneeded and source of bugs as you pointed).