lazyjsonstorage
v1.0.16
Published
This is a module that makes storing data on json files easier # How this works
Downloads
8
Readme
This is a module that makes storing data on json files easier
How this works
Require
var lazyjson = require("lazyjsonstorage")
var file = new lazyjson.JSONfile("test.json")
Insert
Inserts an object in the file.
JSONfile.insert(object)
Search
Searches for (an) object(s) in the file.
console.log(JSONfile.search("key","value"))
console.log(JSONfile.search("key",""))
console.log(JSONfile.search("","value"))
console.log(JSONfile.search(object))
console.log(JSONfile.search(array[object,object...]))
//you can serialize searches
returns an array with the object(s) found
Remove
Removes (an) object(s) from the file.
JSONfile.remove("key","value",number)
JSONfile.remove("key","",number)
JSONfile.remove("","value",number)
JSONfile.remove(object,number)
returns the number of object(s) deleted
Edit
Edits (an) object(s) property(ies) in the file.
JSONfile.edit(object,object)
JSONfile.edit(array[object,object...],object)
/*the first argument is the object to edit and the second
argument is the property(ies) to change*/
returns the number of object(s) edited