Code & Text Diff Checker
100% In-Browser Privacy
Trending
Compare text or source code side-by-side with visual diffs.
+17 Added-11 Removed3 Unchanged
Presets:
UNIFIED GIT DIFF VIEW31 Lines Evaluated
1
-
function calculateInvoiceTotal(items) {
2
-
var total = 0;
3
-
var taxRate = 0.08;
1
+
export interface InvoiceItem {
2
+
id: string;
3
+
price: number;
4
+
quantity: number;
5
+
active: boolean;
6
+
}
47
5
-
for (var i = 0; i < items.length; i++) {
6
-
var item = items[i];
7
-
if (item.active) {
8
-
total = total + (item.price * item.quantity);
9
-
}
10
-
}
8
+
export function calculateInvoiceTotal(
9
+
items: InvoiceItem[],
10
+
taxRate: number = 0.08
11
+
): { subtotal: number; tax: number; total: number } {
12
+
const subtotal = items
13
+
.filter((item) => item.active)
14
+
.reduce((acc, item) => acc + item.price * item.quantity, 0);
1115
12
-
var tax = total * taxRate;
13
-
return total + tax;
16
+
const tax = Number((subtotal * taxRate).toFixed(2));
17
+
const total = Number((subtotal + tax).toFixed(2));
18
+
19
+
return { subtotal, tax, total };
1420
}
AdvertisementOmnikite Zero Data Storage
Adsterra Ad Placement Slot (728x90)Configure keys in
config/ads.ts to display live campaigns.Non-Intrusive Banner
100% Zero-Upload Privacy
All computation executes exclusively inside your device memory using Web APIs and WebAssembly. No data or files ever leave your browser.
Real-Time Native Execution
Zero network roundtrips. Operates offline without sending external API requests, delivering instantaneous sub-millisecond computation.
Developer-First Architecture
Engineered with RFC standards, cryptographic primitives (Web Crypto Subtle API), and production-grade formatting libraries.
Related Developer Tools Utilities
JSON Formatter & ValidatorFormat, validate, repair, and minify JSON data instantly.JWT Decoder & InspectorDecode, verify claims, inspect headers, and check token expiry.IPv4 Subnet & Host Range CalculatorCalculate network address, broadcast, usable host ranges, and binary masks.Linux File Permissions & Chmod CalculatorCalculate 755, 644 octal and symbolic file permissions with commands.