Socket
Socket
Sign inDemoInstall

pro.db

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pro.db - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

32

index.js
const fs = require ('fs')
let addmsg;
class MrSmart {

@@ -39,5 +38,14 @@ constructor() {

}
has(key){
if (!key) throw Error("Cant find the key in the data!");
return Boolean(this.data[key])}
check(data){
if(!fs.existsSync(`data.json`)) {
fs.writeFileSync(`data.json`, "{}");
if(!data)throw new TypeError("The data is not defined!")
const file = JSON.parse(fs.readFileSync("data.json","utf8"))
return file[data] ? true : false
}else{
if(!data)throw new TypeError("The data is not defined!")
const file = JSON.parse(fs.readFileSync("data.json","utf8"))
return file[data] ? true : false
}
}
delete(data){

@@ -71,10 +79,10 @@ if(!fs.existsSync(`data.json`)) {

}
add(key, count){
if (!count) throw Error("The data must defined!");
if (!key) throw Error("The data must defined!");
if(!this.data[key]) this.data[key] = 0;
this.data[key] += count;
this.saveDataToFile();
if(addmsg) {
console.log(addmsg)}}
add(data , value){
if(!fs.existsSync(`data.json`)) {
fs.writeFileSync(`data.json`, "{}");
if(!data)throw new TypeError("The data is not defined!")
if(isNaN(value))throw new TypeError("The value must be a number!")
if(!this.check(data)){
this.set(data , 0)
}

@@ -81,0 +89,0 @@ if(typeof this.fetch(data) !== "number")throw new TypeError("cant add number value to text value!")

{
"name": "pro.db",
"version": "2.0.0",
"version": "2.0.1",
"description": "a simple and easy database package make your life easy.",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc