Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jsonverse

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsonverse - npm Package Compare versions

Comparing version 1.2.6 to 1.2.7

27

index.js

@@ -503,6 +503,5 @@ /*!

async saveData(dataName, newData) {
const existingData = await this.readData(dataName);
if (existingData !== null) {
try {
const existingData = await this.readData(dataName) || [];
const newId = await this.randomID();
const newDataWithId = {

@@ -512,12 +511,18 @@ id: newId,

};
existingData.push(newDataWithId); // Append the new data to the existing array
await this.writeDataByFileName(dataName, existingData).then(() => {
this.logSuccess(`New Data added to DB: ${dataName}`);
});
} else {
this.handleError(`Data failed to be added to the DB: ${dataName}`);
// Remove any existing data with the same ID
const updatedData = existingData.filter((item) => item.id !== newId);
// Add the new data with the same ID
updatedData.push(newDataWithId);
// Write the updated data to the file
await this.writeDataByFileName(dataName, updatedData);
this.logSuccess(`Data updated in DB: ${dataName}`);
} catch (error) {
this.handleError(`Failed to update data in DB: ${dataName}\nError: ${error}`);
}
}

@@ -524,0 +529,0 @@ async delByID(id) {

{
"name": "jsonverse",
"version": "1.2.6",
"version": "1.2.7",
"description": "jsonVerse is a lightweight JSON-based database package for Node.js. It provides a simple interface to store, retrieve, and manage data using JSON files.",

@@ -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