justdata
TypeScript icon, indicating that this package has built-in type declarations

1.4.0 • Public • Published

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!

Package Sidebar

Install

npm i justdata

Weekly Downloads

25

Version

1.4.0

License

MIT

Unpacked Size

31 kB

Total Files

14

Last publish

Collaborators

  • justmoon01
  • manydev