JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q0F
  • License ISC

Db Module Powered By json files

Package Exports

  • drahovdb

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

Readme

DB Module of powered by json files

Installation

npm install drahovdb

Functions

  • add(dataname,value)

  • get(dataname)

  • has(dataname)

  • remove(dataname)

  • copy(filename)

  • increase(dataname,value)

  • reduce(dataname,value)

  • clear()

Descriptions

  • add: Writes any value to dataname.

  • get: Gets value by dataname from filename.

  • has: Returnes true if the dataname has.

  • remove: Deletes any data from file.

  • copy: Copies the file to any file.

  • increase: If the value is number and the data is value you can increase the data.

  • reduce: If the value is number and the data is value you can reduce the data.

  • clear: Deletes all datas from file.

Examples

Constructor

const { Database } = require('drahovdb')

const db = new Database('file') //write file name without .json!

Add

const { Database } = require('drahovdb')

const db = new Database('database')

db.add('nick','drahov') //adds database.json "nick":"drahov" data

Get

const { Database } = require('drahovdb')

const db = new Database('database')

db.get('nick') //returns drahov

Has

const { Database } = require('drahovdb')

const db = new Database('database')

db.has('nick') //returns true

Remove

const { Database } = require('drahovdb')

const db = new Database('database')

db.remove('nick') //deletes nick data

Copy

const { Database } = require('drahovdb')

const db = new Database('database')

db.copy('database_copy') //copies database.json to database_copy.json

Increase

const { Database } = require('drahovdb')

const db = new Database('database')

db.add('int',10)

db.increase('int',1) //increases int value 1

Reduce

const { Database } = require('drahovdb')

const db = new Database('database')

db.reduce('int',1) //reduces int value 1

Copy

const { Database } = require('drahovdb')

const db = new Database('database')

db.clear() //deletes all datas from database.json

Notice

Please write filenames without .json

github