
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
A lightweight library for tracking changes in JSON objects with undo and redo functionality. Efficiently manages changes without duplicating entire objects, ideal for memory-sensitive applications.
JSON Undo is a lightweight library for tracking changes in JSON objects with undo and redo functionality. It is designed for memory-sensitive applications by efficiently managing changes without duplicating entire objects.
npm install json-undo
const JSONChangesTracker = require('json-undo');
const original = { name: "Alice", age: 25 };
const tracker = new JSONChangesTracker(original);
console.log(tracker.get());
// Output: { name: "Alice", age: 25 }
original.name = "Bob";
tracker.update(original);
console.log(tracker.get());
// Output: { name: "Bob", age: 25 }
original.age = 26;
tracker.update(original);
console.log(tracker.get());
// Output: { name: "Bob", age: 26 }
// Undo the last change
tracker.undo();
console.log(tracker.get());
// Output: { name: "Bob", age: 25 }
// Redo the undone change
tracker.redo();
console.log(tracker.get());
// Output: { name: "Bob", age: 26 }
const JSONChangesTracker = require('json-undo');
const original = {
user: { name: "Charlie", details: { age: 30, city: "New York" } },
active: true
};
const tracker = new JSONChangesTracker(original);
console.log(tracker.get());
// Output: { user: { name: "Charlie", details: { age: 30, city: "New York" } }, active: true }
original.user.name = "David";
tracker.update(original);
console.log(tracker.get());
// Output: { user: { name: "David", details: { age: 30, city: "New York" } }, active: true }
original.user.details.city = "San Francisco";
tracker.update(original);
console.log(tracker.get());
// Output: { user: { name: "David", details: { age: 30, city: "San Francisco" } }, active: true }
original.active = false;
tracker.update(original);
console.log(tracker.get());
// Output: { user: { name: "David", details: { age: 30, city: "San Francisco" } }, active: false }
// Undo all changes
tracker.undo();
console.log(tracker.get());
// Output: { user: { name: "David", details: { age: 30, city: "New York" } }, active: true }
tracker.undo();
console.log(tracker.get());
// Output: { user: { name: "Charlie", details: { age: 30, city: "New York" } }, active: true }
// Redo the last undo
tracker.redo();
console.log(tracker.get());
// Output: { user: { name: "David", details: { age: 30, city: "New York" } }, active: true }
tracker.redo();
console.log(tracker.get());
// Output: { user: { name: "David", details: { age: 30, city: "San Francisco" } }, active: true }
const JSONChangesTracker = require('json-undo');
const original = { item: "Laptop", price: 1000 };
const tracker = new JSONChangesTracker(original);
console.log(tracker.canUndo()); // Output: false (No changes yet)
console.log(tracker.canRedo()); // Output: false (No undone changes)
original.price = 1200;
tracker.update(original);
console.log(tracker.get()); // Output: { item: "Laptop", price: 1200 }
console.log(tracker.canUndo()); // Output: true (Undo possible)
console.log(tracker.canRedo()); // Output: false (No redo yet)
tracker.undo();
console.log(tracker.get()); // Output: { item: "Laptop", price: 1000 }
console.log(tracker.canUndo()); // Output: false (No more undo)
console.log(tracker.canRedo()); // Output: true (Redo possible)
tracker.redo();
console.log(tracker.get()); // Output: { item: "Laptop", price: 1200 }
new JSONChangesTracker(initialJson: object)Creates an instance of JSONChangesTracker.
update(updatedJson: object)Tracks the changes in the provided JSON object.
undo(): objectReverts the JSON object to the previous state.
redo(): objectRestores the JSON object to the state before the undo.
get(): objectReturns the current state of the JSON object.
canUndo(): booleanReturns true if there is a history of changes to undo.
canRedo(): booleanReturns true if there are undone changes to redo.
This project is licensed under the MIT License.
Manish Gun
FAQs
A lightweight library for tracking changes in JSON objects with undo and redo functionality. Efficiently manages changes without duplicating entire objects, ideal for memory-sensitive applications.
We found that json-undo demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.