Joseph Morukhuladi

2025 Feb 16 15:36

JavaScript Library

A JavaScript library that makes managing JSON data in local storage easy

I have always wanted an easier and organised way of working with JSON data with local storage, So I built Qwery.js just for that reason.

I am going start with the description of the library. Qwery is a JavaScript library that allows a developer to add, get and update JSON data in a strucutred way on local storage. The reason behind is quite straightforward, managing JSON data in local storage made easy.

The library requires just your basic understating of syntax's similar to LINQ, MongoDB Node.js driver etc. It follows a simple syntax structure that uses methods.
You can find the library on Github
Let's check how we can create our Qwery object!

/*The first step will be creating an instance of the Qwery object and then creating the record in local storage*/ const qwery = new Qwery({ name: "app_data" }).create(); /*The "create" method is essential as it check and create the record in local storage if it does not exist, if it does exist then it configures the object for usage in later steps.*/
/*For this blog we will be using the add and get functions to show the easy usage of Qwery.js*/
/*Let's create a JSON object with simple data inside it'*/
const appInfo = { id: 1, OS: "Windows", key: "V1-3442-AFD3-5221" }

/*Qwery.js works with datasets. Datasets in Qwery js are like tables, they store an array of data.*/
/*Let's add an entry to the 'app-info' dataset*/
qwery.add({ dataset: "app-info", data: appInfo});

/*Then we fetch the entry by id, from the 'app-info' dataset*/
/*To fetch a single record from a dataset, you are going to need to specify the field you wish to use to filter by, and by the value you want to use*/
const item = qwery.get({ dataset: "app-info", field: "id", value: 1 });
console.log(item);

//The iten will be a JSON object when returned from the "get" method /* { "id": 1, "OS": "Windows", "key": "V1-3442-AFD3-5221" } */

And with that you are able to use Qwery.js. There are many more other methods you can explore. Be sure to check it out

#front-end

#javascript

#javascript-library

#qwery

#github

#local-storage