Danych is a 1kb lightweight database in the browser. Danych is simply a Browser Storage built on top of localStorage and sessionStorage.
npm i danychimport useDanych from "danych"
interface Todo {
id: number
text: string
}
//Starting with full config
const db = useDanych.init<Todo>({
key: "my-app-data",
type: "session"
})
//OR, start localStorage with just the key
const db = useDanych.db("my-database-key")
//OR, start sessionStorage with just the key
const db = useDanych.state("my-database-key")store new data using Danych.
//set new data
db.set({ id: 1, text: "some data" })
//set data with id
db.set({ id: 1, text: "some data" }, 0)get all the datas or get data with id.
//get all the store datas
const datas = db.get()
//get data with id
const datas = db.get(1)//update data with id
db.update({ id: 64, text: "new data value" }, 1)//remove data with id
db.remove(0)
//remove last stored data
db.remove()- datas - return all store datas.
###Danych is 750 Bytes, Fast, Fully Typed and Lightweight 🚀💨
MIT ©