Code Diff Compare

Compare side-by-side versions of text to highlight line modifications.

Code Diff Inspector

Compare two code snippets side-by-side with intraline word highlights & split/unified view.

Version A (Original)
Version B (Modified)
+8 Additions-7 Deletions7 Matches
Diff Inspection OutputSplit Side-by-Side Mode
1// User Profile API Handler v1.0
2function getUserProfile(userId, options = {}) {
3 if (!userId) {
4 throw new Error("User ID is required");
1// User Profile API Handler v2.0 (Security Patched)
2async function getUserProfile(userId, options = {}) {
3 if (!userId || typeof userId !== 'string') {
4 throw new Error("Valid User ID is required");
5 }5 }
66
7 const query = "SELECT id, name, email FROM users WHERE id = " + userId;
8 const user = db.query(query);
7 const query = "SELECT id, name, email, avatar_url FROM users WHERE id = $1";
8 const user = await db.query(query, [userId]);
99
10 return {10 return {
11 status: 200,11 status: 200,
12 data: user
12 data: user,
13 timestamp: Date.now()
13 };14 };
14}15}