Skip to content

v1.0.1 - Bug Fixes and Test Coverage Improvements

Choose a tag to compare

@AngusHsu AngusHsu released this 17 Nov 12:37
· 16 commits to main since this release

�� Bug Fixes and Test Coverage Improvements

What's Changed

�� Critical Bug Fix

  • Fixed Lithuanian ID year calculation - Lithuanian Personal Codes with first digit '3' or '4' were incorrectly parsed as 1800s instead of 1900s
    • This affected all Lithuanian IDs for people born between 1900-1999
    • Year calculation now uses clear, explicit logic instead of a flawed mathematical formula
    • All century digits (1-8) now properly validated and mapped

✨ New Features

  • Added parseIdInfo support for Iceland (ISL), Lithuania (LTU), and Luxembourg (LUX)
    • These countries can now extract detailed information from ID numbers
    • Birth dates, gender, and other metadata now available

📊 Test Coverage Improvements

  • Added 101 comprehensive tests for 9 low-coverage countries
  • Overall coverage improved from 61.95% to 68.24% (+6.29%)

Coverage by Country:

  • 🇭🇰 Hong Kong (HKG): 20.00% → 100.00% (+80.00%)
  • 🇨🇴 Colombia (COL): 20.68% → 89.65% (+68.97%)
  • 🇮🇸 Iceland (ISL): 15.38% → 82.05% (+66.67%)
  • 🇱🇹 Lithuania (LTU): 15.38% → 81.35% (+65.97%)
  • 🇭🇺 Hungary (HUN): 13.04% → 76.08% (+63.04%)
  • 🇦🇱 Albania (ALB): 17.64% → 79.41% (+61.77%)
  • 🇱🇺 Luxembourg (LUX): 15.38% → 78.12% (+62.74%)
  • 🇮🇷 Iran (IRN): 20.83% → 83.33% (+62.50%)
  • 🇮🇱 Israel (ISR): 25.00% → 75.00% (+50.00%)

📝 Documentation

  • Fixed country count discrepancy (103 → 80 countries) in package.json

Installation

npm install idnumbers@1.0.1

Migration from v1.0.0

This is a patch release with bug fixes and improvements:

  • No breaking changes
  • Backward compatible with v1.0.0
  • ⚠️ Lithuanian IDs will now return correct birth years (if you were using the old incorrect values, update your logic)

Example Usage

import { validateNationalId, parseIdInfo } from 'idnumbers';

// Fixed: Lithuanian ID now correctly parses year
const ltu = parseIdInfo('LTU', '39001010077');
console.log(ltu?.birthDate.getFullYear()); // 1990 (was 1890 before)

// New: Iceland parsing support
const isl = parseIdInfo('ISL', '120174-3399');
console.log(isl?.birthDate); // 1974-01-12

// New: Luxembourg parsing support
const lux = parseIdInfo('LUX', '1893120105732');
console.log(lux?.birthDate); // 1893-12-01

Full Test Results

Test Suites: 6 passed, 6 total
Tests:       402 passed, 402 total
Time:        6.405s

Contributors

Special thanks to all contributors who helped improve this release!


Full Changelog: v1.0.0...v1.0.1