Skip to content
This repository was archived by the owner on Nov 22, 2025. It is now read-only.

Conversation

@meabed
Copy link
Contributor

@meabed meabed commented Aug 26, 2025

Summary

  • Enhanced name detection to properly handle patterns like j7.d2
  • Now correctly extracts single letters as valid names when they appear with numbers
  • Improves parsing of email addresses with single-letter initials combined with numbers

Changes

  • Modified parseCompositeNamePart function to accept single letters after number removal
  • Added allowSingleLetter parameter to isLikelyName function for explicit single-letter validation
  • Updated validation logic to allow single letters in appropriate contexts
  • Added test cases for j7.d2 pattern verification

Test Results

All tests pass successfully. The implementation now correctly:

  • Extracts 'J' and 'D' from j7.d2@example.com
  • Extracts 'A' and 'B' from a1.b2@example.com
  • Still extracts 'John' and 'Due' from john1.due2@example.com
  • Maintains backward compatibility for all other patterns

Example

detectName('j7.d2@example.com')
// Returns: { firstName: 'J', lastName: 'D', confidence: 0.85 }

Fixes the handling of single-letter alphanumeric patterns as requested.

Enhanced name detection to properly handle patterns like j7.d2, extracting single letters as valid names when they appear with numbers. This improvement allows the detector to correctly parse email addresses with single-letter initials combined with numbers.

- Modified parseCompositeNamePart to accept single letters after number removal
- Added allowSingleLetter parameter to isLikelyName function
- Updated test cases to verify j7.d2 pattern correctly extracts 'J' and 'D'
@meabed meabed merged commit 00dafd9 into master Aug 26, 2025
1 check passed
@meabed meabed deleted the feat/single-letter-name-detection branch August 26, 2025 22:20
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants