Socket
Socket
Sign inDemoInstall

justdata

Package Overview
Dependencies
0
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    justdata

a JSON/YAML/LocalStorage database module


Version published
Weekly downloads
34
decreased by-57.5%
Maintainers
2
Install size
30.2 kB
Created
Weekly downloads
 

Readme

Source

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!

Keywords

FAQs

Last updated on 05 Jan 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc