hckhanh
vn-number
BlogDocsChangelog

Simplify conditional expressions in reading utilities

#75Merged
Comparing
optimize
(
fe2cfa9
) with
main
(
5c00605
)
CodSpeed Performance Gauge
+17%
Improvements
1
Untouched
63

Benchmarks

Improved

display financial dashboard (20 metrics)
src/read/index.bench.ts::readVnNumber - real-world application scenarios
CodSpeed Performance Gauge
+17%
901.8 µs774 µs

Passed

invoice total (5,450,000 VND)
src/read/index.bench.ts::readVnNumber - typical usage scenarios
CodSpeed Performance Gauge
+10%
57.8 µs52.6 µs
display payment receipt (typical transaction)
src/read/index.bench.ts::readVnNumber - real-world application scenarios
CodSpeed Performance Gauge
+1%
61.1 µs60.6 µs
format total sales (125,678)
src/format/number.bench.ts::formatVnNumber - typical usage scenarios
CodSpeed Performance Gauge
+1%
28.7 µs28.5 µs
format decimal value (12,345.67)
src/format/number.bench.ts::formatVnNumber - typical usage scenarios
CodSpeed Performance Gauge
+1%
29.9 µs29.7 µs
format monthly revenue (125,000,000 VND)
src/format/number.bench.ts::formatVnCurrency - typical usage scenarios
CodSpeed Performance Gauge
+1%
28.1 µs27.9 µs
format large contract (15,000,000,000 VND)
src/format/number.bench.ts::formatVnCurrency - typical usage scenarios
CodSpeed Performance Gauge
+1%
28.4 µs28.2 µs
format order count (1,234)
src/format/number.bench.ts::formatVnNumber - typical usage scenarios
CodSpeed Performance Gauge
+1%
28.7 µs28.5 µs
format negative value (-5,432)
src/format/number.bench.ts::formatVnNumber - typical usage scenarios
CodSpeed Performance Gauge
+1%
28.9 µs28.7 µs
format user count (5,432,100)
src/format/number.bench.ts::formatVnNumber - typical usage scenarios
CodSpeed Performance Gauge
+1%
29 µs28.8 µs
format invoice total (5,450,000 VND)
src/format/number.bench.ts::formatVnCurrency - typical usage scenarios
CodSpeed Performance Gauge
+1%
29.3 µs29.1 µs
display product catalog (20 products)
src/read/index.bench.ts::readVnNumber - real-world application scenarios
CodSpeed Performance Gauge
+1%
65 µs64.6 µs
format small price (15,000 VND)
src/format/number.bench.ts::formatVnCurrency - typical usage scenarios
CodSpeed Performance Gauge
+1%
29.8 µs29.7 µs
format 50 product quantities
src/format/number.bench.ts::formatVnNumber - realistic batch operations
CodSpeed Performance Gauge
+1%
32.1 µs31.9 µs
format negative change (-10%)
src/format/number.bench.ts::formatVnPercent - typical usage scenarios
CodSpeed Performance Gauge
+1%
28.1 µs27.9 µs
format annual budget (2,500,000,000 VND)
src/format/number.bench.ts::formatVnCurrency - typical usage scenarios
CodSpeed Performance Gauge
+1%
28.4 µs28.2 µs
format typical product price (199,000 VND)
src/format/number.bench.ts::formatVnCurrency - typical usage scenarios
CodSpeed Performance Gauge
0%
29.9 µs29.7 µs
format complete product listing (30 products)
src/format/number.bench.ts::combined operations - real-world scenarios
CodSpeed Performance Gauge
0%
43.7 µs43.5 µs
format all three types together (typical dashboard row)
src/format/number.bench.ts::combined operations - real-world scenarios
CodSpeed Performance Gauge
0%
35.8 µs35.6 µs
format decimal amount (199,000.50 VND)
src/format/number.bench.ts::formatVnCurrency - typical usage scenarios
CodSpeed Performance Gauge
0%
30.4 µs30.3 µs
format product quantity (15)
src/format/number.bench.ts::formatVnNumber - typical usage scenarios
CodSpeed Performance Gauge
0%
36.8 µs36.6 µs
display data table (50 rows × 6 columns)
src/format/number.bench.ts::real-world application scenarios
CodSpeed Performance Gauge
0%
50.5 µs50.3 µs
format 50 order counts
src/format/number.bench.ts::formatVnNumber - realistic batch operations
CodSpeed Performance Gauge
0%
32.6 µs32.4 µs
format 50 invoice totals (100k-100M VND)
src/format/number.bench.ts::formatVnCurrency - realistic batch operations
CodSpeed Performance Gauge
0%
33.4 µs33.3 µs
display e-commerce product card
src/format/number.bench.ts::real-world application scenarios
CodSpeed Performance Gauge
0%
40.7 µs40.5 µs
formatVnNumber with different input types
src/format/number.bench.ts::input type variations - real-world scenarios
CodSpeed Performance Gauge
0%
45.6 µs45.5 µs
display product catalog (20 products)
src/format/number.bench.ts::real-world application scenarios
CodSpeed Performance Gauge
0%
53.3 µs53.1 µs
display invoice (10 line items)
src/format/number.bench.ts::real-world application scenarios
CodSpeed Performance Gauge
0%
53.9 µs53.7 µs
format 50 completion rates (0-100%)
src/format/number.bench.ts::formatVnPercent - realistic batch operations
CodSpeed Performance Gauge
0%
32.9 µs32.8 µs
format 50 e-commerce prices (10k-50M VND)
src/format/number.bench.ts::formatVnCurrency - realistic batch operations
CodSpeed Performance Gauge
0%
33.4 µs33.3 µs
format 50 growth rates (-50% to +150%)
src/format/number.bench.ts::formatVnPercent - realistic batch operations
CodSpeed Performance Gauge
0%
33.5 µs33.4 µs
number input (typical price)
src/read/index.bench.ts::readVnNumber - input type variations
CodSpeed Performance Gauge
0%
42.8 µs42.6 µs
format transaction amount (19,990,000 VND)
src/format/number.bench.ts::formatVnCurrency - typical usage scenarios
CodSpeed Performance Gauge
0%
34.1 µs33.9 µs
format 50 financial amounts (1M-10B VND)
src/format/number.bench.ts::formatVnCurrency - realistic batch operations
CodSpeed Performance Gauge
0%
34.3 µs34.2 µs
format over target (125%)
src/format/number.bench.ts::formatVnPercent - typical usage scenarios
CodSpeed Performance Gauge
0%
29.1 µs29 µs
display financial dashboard (weekly metrics)
src/format/number.bench.ts::real-world application scenarios
CodSpeed Performance Gauge
0%
163.9 µs163.4 µs
format discount rate (15%)
src/format/number.bench.ts::formatVnPercent - typical usage scenarios
CodSpeed Performance Gauge
0%
28.9 µs28.8 µs
format completion rate (75%)
src/format/number.bench.ts::formatVnPercent - typical usage scenarios
CodSpeed Performance Gauge
0%
29 µs28.9 µs
format conversion rate (2.5%)
src/format/number.bench.ts::formatVnPercent - typical usage scenarios
CodSpeed Performance Gauge
0%
29.5 µs29.5 µs
display payment summary
src/format/number.bench.ts::real-world application scenarios
CodSpeed Performance Gauge
0%
43 µs42.9 µs
display shopping cart (5 items)
src/format/number.bench.ts::real-world application scenarios
CodSpeed Performance Gauge
0%
118.9 µs118.6 µs
format 50 conversion rates (0-10%)
src/format/number.bench.ts::formatVnPercent - realistic batch operations
CodSpeed Performance Gauge
0%
33.1 µs33 µs
display invoice line items (10 items)
src/read/index.bench.ts::readVnNumber - real-world application scenarios
CodSpeed Performance Gauge
0%
74.7 µs74.5 µs
formatVnCurrency with different input types
src/format/number.bench.ts::input type variations - real-world scenarios
CodSpeed Performance Gauge
0%
48.2 µs48.1 µs
format small percentage (0.5%)
src/format/number.bench.ts::formatVnPercent - typical usage scenarios
CodSpeed Performance Gauge
0%
29.5 µs29.4 µs
format full completion (100%)
src/format/number.bench.ts::formatVnPercent - typical usage scenarios
CodSpeed Performance Gauge
0%
28.2 µs28.1 µs
format interest rate (5.5%)
src/format/number.bench.ts::formatVnPercent - typical usage scenarios
CodSpeed Performance Gauge
0%
29.5 µs29.4 µs
format growth rate (25%)
src/format/number.bench.ts::formatVnPercent - typical usage scenarios
CodSpeed Performance Gauge
0%
29 µs28.9 µs
read 50 financial amounts (1M-10B VND)
src/read/index.bench.ts::readVnNumber - realistic batch operations
CodSpeed Performance Gauge
0%
71.5 µs71.4 µs
display shopping cart (5 items with quantities)
src/read/index.bench.ts::readVnNumber - real-world application scenarios
CodSpeed Performance Gauge
0%
170.3 µs170 µs
bigint input (large transaction)
src/read/index.bench.ts::readVnNumber - input type variations
CodSpeed Performance Gauge
0%
40.3 µs40.3 µs
mixed input types in data processing (30 values)
src/format/number.bench.ts::input type variations - real-world scenarios
CodSpeed Performance Gauge
0%
136.8 µs136.6 µs
read 50 invoice totals (100k-100M VND)
src/read/index.bench.ts::readVnNumber - realistic batch operations
CodSpeed Performance Gauge
0%
62.1 µs62 µs
transaction amount (19,990,000 VND)
src/read/index.bench.ts::readVnNumber - typical usage scenarios
CodSpeed Performance Gauge
0%
53 µs53 µs
read 50 product quantities (1-100)
src/read/index.bench.ts::readVnNumber - realistic batch operations
CodSpeed Performance Gauge
0%
50.1 µs50.1 µs
string input (from API/form)
src/read/index.bench.ts::readVnNumber - input type variations
CodSpeed Performance Gauge
0%
45.9 µs45.9 µs
formatVnPercent with different input types
src/format/number.bench.ts::input type variations - real-world scenarios
CodSpeed Performance Gauge
0%
42.1 µs42.1 µs
product quantity (5 items)
src/read/index.bench.ts::readVnNumber - typical usage scenarios
CodSpeed Performance Gauge
0%
66.8 µs66.8 µs
annual revenue (2,500,000,000 VND)
src/read/index.bench.ts::readVnNumber - typical usage scenarios
CodSpeed Performance Gauge
0%
53.9 µs53.9 µs
display sales report (monthly performance)
src/format/number.bench.ts::real-world application scenarios
CodSpeed Performance Gauge
0%
616.6 µs616.9 µs
read 50 e-commerce prices (10k-50M VND)
src/read/index.bench.ts::readVnNumber - realistic batch operations
CodSpeed Performance Gauge
0%
61.4 µs61.5 µs
mixed input types in data processing (30 values)
src/read/index.bench.ts::readVnNumber - input type variations
CodSpeed Performance Gauge
0%
245.9 µs246.3 µs
large contract value (15,000,000,000 VND)
src/read/index.bench.ts::readVnNumber - typical usage scenarios
CodSpeed Performance Gauge
0%
49.6 µs49.6 µs
typical product price (199,000 VND)
src/read/index.bench.ts::readVnNumber - typical usage scenarios
CodSpeed Performance Gauge
-1%
65.2 µs65.6 µs

Commits

Click on a commit to change the comparison range
Base
main
5c00605
+17.41%
Simplify conditional expressions in reading utilities Refactored multiple functions to use concise conditional expressions, improving readability and reducing code verbosity. These changes enhance maintainability without altering existing functionality.
7c66e35
2 days ago
by hckhanh
-1%
Refactor `readTens` function for conciseness Simplified the `readTens` function by replacing nested ternary operators with straightforward conditional statements. This improves readability and maintains the same functionality.
a6581da
2 days ago
by hckhanh
+0.03%
Simplify conditional in `readHundreds` function Reversed the ternary operator condition to improve code clarity and consistency with other similar functions. This adjustment maintains the original functionality while enhancing readability.
7a3e381
2 days ago
by hckhanh
+0.05%
Refactor `readHundreds` function for clarity and flexibility Replaced the `hasHundredsPosition` parameter with `groupLength` to improve clarity and make the function more versatile. Updated dependent code to reflect this change and maintain consistent behavior.
55f2b90
2 days ago
by hckhanh
-0.07%
Clarify `hasTensPosition` variable usage in `read` function Renamed and refactored the variable `len > 1` to `hasTensPosition` for improved readability and intent clarity. Updated its usage across the function to enhance maintainability without changing the existing behavior.
190a848
2 days ago
by hckhanh
+0.11%
Refactor digit group processing for readability Improved code readability and consistency in functions handling Vietnamese number words. Simplified conditionals, standardized parameter usage, and enhanced formatting to ensure maintainability without altering functionality.
b8bf24e
2 days ago
by hckhanh
+0.05%
Update devDependencies in `package.json` and lockfile Upgraded several devDependencies including `@biomejs/biome`, `syncpack`, and `tsdown` to the latest versions. This ensures compatibility with the latest features and improvements while maintaining stability. Updated the `pnpm-lock.yaml` to reflect these changes.
f167425
2 days ago
by hckhanh
-0.04%
Refactor group processing conditionals for readability Replaced a nested ternary operator with explicit conditional statements in `groups.ts`. This enhances code readability and aligns with the consistent structure of similar functions. No functionality was altered.
a22a9d7
2 days ago
by hckhanh
-0.02%
Refactor digit group processing and update dependencies Improved readability, simplified logic, and standardized parameter handling in functions processing Vietnamese number words. Made minor formatting updates, enhanced code quality, and updated development dependencies in `package.json`.
fe2cfa9
2 days ago
by hckhanh
© 2025 CodSpeed Technology
Home Terms Privacy Docs