JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 17
  • Score
    100M100P100Q38534F
  • License MIT

a JSON/YAML/LocalStorage database module

Package Exports

  • justdata
  • justdata/Main/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (justdata) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

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!