Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

justdata

justmoon0132MIT1.4.0TypeScript support: included

a JSON/YAML/LocalStorage database module

just, just-api, justapi, justdb, just-db, justdata, json, jsondb, yaml, yamldb, local, localstorage, local storage, node-json-db, db, database

readme

Discord server npm version npm downloads

JustData

a JSON database module

Examples

Moving Data From Quick.DB

const data = require("justdata");
const quickdb = require("quick.db");

data.move(quickdb)

Normal Example

const data = require("justdata")

data.set("x.y.z", "abc") // abc

data.get("x") // {y: {z: "abc"}}
data.fetch("x") // {y: {z: "abc"}}
data.all() // {x: {y: {z: "abc"}}}

data.push("a", "hello") //  ["hello"]
data.push("a", "world") //  ["hello", "world"]
data.unpush("a", "hello") // ["world"]

data.push("b", {test: "justdata"}) // [{test: "justdata"}]
data.push("b", {test2: "justdata2"}) // [{test: "justdata"}, {test2: "justdata2"}]
data.delByPriority("b", 1) // [{test2: "justdata"}]
data.setByPriority("b", {newtest:"hey this is edited"}, 1) // [{newtest:"hey this is edited"}]

data.has("x") // true
data.delete("x") // true
data.deleteAll() // true

With Options Example

const data = require("justdata")

data.setReadable(true) // It makes readable your JSON DB file.

data.noBlankData(true) // If you delete anything from object and new object size is less than 1, automaticly removes that object.

data.setAdapter("yamldb") // It makes adapter as written adapter. Default adapter is JsonDB

data.set("x.y.z", "abc") // abc

data.get("x") // {y: {z: "abc"}}
data.fetch("x") // {y: {z: "abc"}}
data.all() // {x: {y: {z: "abc"}}}

data.push("a", "hello") //  ["hello"]
data.push("a", "world") //  ["hello", "world"]
data.unpush("a", "hello") // ["world"]

data.push("b", {test: "justdata"}) // [{test: "justdata"}]
data.push("b", {test2: "justdata2"}) // [{test: "justdata"}, {test2: "justdata2"}]
data.delByPriority("b", 1) // [{test2: "justdata"}]
data.setByPriority("b", {newtest:"hey this is edited"}, 1) // [{newtest:"hey this is edited"}]

data.has("x") // true
data.delete("x") // true
data.deleteAll() // true

If you've any question, you can join to my Discord server: Click me!