( LocalStorageRepo )
A repo generator that uses only on key of the sessionStorage to store all data in a unique Array. is write in pure ES5 and implements a comple generic CRUD.
Goals
To have a generic repo (CRUD) generator linked to one key of the LocalStorage for use it as a lightweitgt persistence system directly in the browser.
you can use for ...
some examples Store all data you need indexed and easly accesible as you can do with a "repo" as in a imaginary animal clinic.
petsRepo = "pets" "name";productRepo = "products" "idProduct"; petsRepo;petsRepo;consolepetsRepo;petsRepo;//find all cats only , no dogs.
but you can do some other stuff , like ... store functions as text indexed by name and rerun later ;) dont know why someone want to do this :P
functions = "functions" "name"functions
save an Oajax response.... and all that you wants , if it can be stored in a nutshell of course ^^
rxjs
Instalation
include as script for prod
include as script for devel
or copypaste in console https://github.com/pascualmg/LocalStorageRepo/blob/master/LocalStorageRepo.js
(https://stackoverflow.com/questions/6551446/can-i-run-html-files-directly-from-github-instead-of-just-viewing-their-source)
functional load test create 1001 elements , delete 500 update 500
{ var repo = "logs" "id"; repo; for var i = 1000; i >= 0; i-- //CREATE 1001 elements repo;//only requires the id for var i = 499; i >= 0; i-- //DELETE 500 repo //uses the "id" as id for var metaId = 500; metaId <= 1000; metaId++ //UPDATE 500 repo; console }
Unitary test with jest
npm installnpm test
Limitations
The max quote , is the max quote of a key -> value in the DataStorage in your navigator .