1.0.1 • Published 5 months ago
@adz946/true-name v1.0.1
true-name-js
A modular, human-aware, real-world-friendly name validator for JavaScript and Node.js.
✅ Features
- ✅ Accepts real names with:
- Initials (up to 2 max)
- Accents (e.g., "Élodie", "Lémieux")
- Hyphens (e.g., "Jean-Pierre")
- Apostrophes (e.g., "O'Neill", "Mac'Donald")
- ❌ Rejects:
- Invalid symbols (
!@#
) or digits - Triple-compound, nonsense, or malformed structures
- Fake, partial, or malformed initials
- Invalid symbols (
🔌 Installation
npm install @adz946/true-name
🚀 Usage
import { isValidFullName } from '@adz946/true-name';
isValidFullName("John Smith"); // true
isValidFullName("J. R. R."); // false (too many initials)
isValidFullName("Anna-Marie O'Neill"); // true
isValidFullName("X Æ A-12"); // false (invalid structure)
🧪 Run Tests
A curated test suite is available in the /test
folder.
npm test
You’ll see output like:
Test Name | Ex. | Ac. | Notes
------------------------------------------------------------
John Smith | ✅ | ✅ | N/A
J. R. R. | ❌ | ❌ | N/A
...
📂 Structure
true-name-js/
├── src/
│ └── validateName.js # Main exported validator
├── test/
│ ├── testCases.js # Test data (names + expected result)
│ └── testRunner.js # CLI output formatter
└── README.md
📜 License
MIT — use freely, improve freely, but don’t pretend you wrote it all by yourself 😉