New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

custom.db

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

custom.db - npm Package Compare versions

Comparing version 1.0.1 to 2.0.0

src/DatabaseError.js

2

package.json
{
"name": "custom.db",
"version": "1.0.1",
"version": "2.0.0",
"description": "an Custom Database",

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

@@ -15,3 +15,3 @@ # Installation

path: "Databases",
name: "database.json"
name: "database"
})

@@ -18,0 +18,0 @@

const fs = require("fs");
const { set, get, unset } = require("lodash");
const DatabaseError = require("./DatabaseError.js")

@@ -18,6 +19,6 @@ class Database {

if (path === "" || typeof path !== "string") {
throw new Error("Unapproved path!")
throw new DatabaseError("Unapproved path!")
}
if(value === ""|| value === undefined || value === null) {
throw new Error("Unapproved value!")
throw new DatabaseError("Unapproved value!")
}

@@ -32,3 +33,3 @@

if (path === "" || typeof path !== "string") {
throw new Error("Unapproved path!");
throw new DatabaseError("Unapproved path!");
}

@@ -58,3 +59,3 @@ const jdata = this.toJSON();

if (typeof limit !== "number") {
throw new Error("Must be of limit number type!");
throw new DatabaseError("Must be of limit number type!");
}

@@ -73,3 +74,3 @@ const data = JSON.parse(fs.readFileSync(this.path, "utf-8"));

if (path === "" || typeof path !== "string") {
throw new Error("Unapproved key!");
throw new DatabaseError("Unapproved key!");
}

@@ -90,6 +91,6 @@ const data = this.toJSON();

if (Array.isArray(value) || isNaN(value)) {
throw new Error(`The value is not an number.`);
throw new DatabaseError(`The value is not an number.`);
}
if(value <= 0) throw new Error("Value can't be less than 1")
if(value <= 0) throw new DatabaseError("Value can't be less than 1")

@@ -101,3 +102,3 @@ let data = this.get(path);

}
if (Array.isArray(data) || isNaN(data)) throw new Error(`${path} is not an number key.`);
if (Array.isArray(data) || isNaN(data)) throw new DatabaseError(`${path} is not an number key.`);

@@ -111,13 +112,13 @@ data = Number(data);

if (Array.isArray(value) || isNaN(value)) {
throw new Error(`The value is not an number.`);
throw new DatabaseError(`The value is not an number.`);
}
if(value <= 0) throw new Error("Value can't be less than 1")
if(value <= 0) throw new DatabaseError("Value can't be less than 1")
let data = this.get(path);
if (typeof goToNegative !== "boolean") throw new Error(`The goToNegative parameter must be of boolean type.`);
if (typeof goToNegative !== "boolean") throw new DatabaseError(`The goToNegative parameter must be of boolean type.`);
if(!data && data != 0) {
return this.set(path, value);
}
if (Array.isArray(data) || isNaN(data)) throw new Error(`${path} is not an number key.`);
if (Array.isArray(data) || isNaN(data)) throw new DatabaseError(`${path} is not an number key.`);

@@ -124,0 +125,0 @@ data = Number(data);

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