lazyjsonstorage

1.0.16 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i lazyjsonstorage

Weekly Downloads

6

Version

1.0.16

License

ISC

Unpacked Size

10.5 kB

Total Files

3

Last publish

Collaborators

  • elmoustacho