JSPM

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

a secure json file that serves as a database

Package Exports

  • secure_json_database

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 (secure_json_database) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

sjdb - a secure json database

Install

$ npm install secure_json_database --save

Implementing

First initialize a object for your database.

var sjdb = require("secure_json_database")

var SecureJsonDB = new sjdb({
    path: "your path.sjson",
    key: "your private key"
})

Tables

A table is just a way of organizing your data easily

//adding a table to the database
SecureJsonDB.addTable("table name")

//getting all the table names
SecureJsonDB.getAllTableNames()

//getting a javascript object from a table by name
SecureJsonDB.getTable("table name")

Manipulating data

Adding data to the database is very simple

SecureJsonDB.insert("table name", data)

Removing data

SecureJsonDB.removeAllBy("table name", propertie) //propertie must be a object for example {id: "the id of a entry"}

Updating a data entry

SecureJsonDB.updateByID("table name", "id of the entry", obj) //obj is an object with the uptedated data in it

Finding data

//finding the first data that has the propertie you give
var data = SecureJsonDB.find("table name", properties) //properties must be an object

//finding the last data that has the propertie you give
var lastData = SecureJsonDB.findLast("table name", properties) //properties must be an object

//finding all data that have the propertie you give
var allData = SecureJsonDB.findAll("table name", properties) //properties must be an object
// allData is an array off all the matched data

Examples