Skip to content

Instantly share code, notes, and snippets.

View ezhillragesh's full-sized avatar

Ragesh ezhillragesh

View GitHub Profile
@ezhillragesh
ezhillragesh / dbMain.js
Created January 3, 2024 05:19
A simple Node.js module for handling JSON databases with read, write, and update functionalities. The module includes error handling and is designed for ease of use in small-scale projects. Perfect for managing and manipulating JSON data in Node.js applications. made by ragesh
// dbMain.js
const fs = require('fs');
function readDB(nameDB) {
try {
const data = fs.readFileSync(nameDB, 'utf8');
return JSON.parse(data);
} catch (err) {
console.error("Failed to read data:", err);
return null;
@ezhillragesh
ezhillragesh / reconciler.js
Last active December 10, 2023 04:23
Dynamic DOM rendering with a reconciler mechanism using a virtual DOM approach.
let virtualDocument = [];
function updateDOMElements(existingDOM, currentDOM) {
var parentElement = document.getElementById("mainArea");
let additions = 0, removals = 0, modifications = 0;
currentDOM.forEach(function(item) {