Registry / serialization / another-name-parser

another-name-parser

JSON →
library0.1.0jsnpmunverified

Another Name Parser is a lightweight JavaScript utility designed to break down personal names into their constituent parts: prefix (title), first name, middle name/initial, last name (family name), and suffix. It is primarily built for US English name conventions but can be useful in other contexts. The current stable version is 0.1.0, which includes TypeScript typing definitions. Release cadence appears infrequent, mainly driven by dependency updates and feature additions like the recent TypeScript support. Key differentiators include its ability to handle common prefixes, retain periods in titles, recognize compound first and last names, correctly parse 'Last Name, First Name' order, and intelligently ignore quoted or parenthesized nicknames, providing a clean parsed output.

npm install another-name-parser
INSTALL
IMPORT
SIG · ANOTHER-NAME-PARSE
A
another-name-parser
serializationjavascriptv0.1.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

parser
import parser from 'another-name-parser';
const parser = require('another-name-parser');
While the README shows `require`, `another-name-parser` is a CommonJS module that can be imported as a default export in ESM environments. For pure CommonJS, `require` is correct.
NameParserFunction
import type { NameParserFunction } from 'another-name-parser';
Type import for the main parser function, available since v0.1.0 (tagged as v0.10.0).
ParsedName
import type { ParsedName } from 'another-name-parser';
Type import for the object returned by the parser, available since v0.1.0 (tagged as v0.10.0).

Demonstrates parsing complex personal name strings, including those with prefixes, suffixes, middle initials, nicknames, and 'Last, First' order, into structured objects.

import parser from 'another-name-parser'; const nameString1 = 'Commissioner James "Jim" W. Gordon, Sr.'; const parsedName1 = parser(nameString1); console.log('Parsed name 1:'); console.log(parsedName1); /* Output: { prefix: 'Commissioner', first: 'James', middle: 'W.', last: 'Gordon', suffix: 'Sr.', original: 'Commissioner James "Jim" W. Gordon, Sr.' } */ const nameString2 = 'Gordon, James W.'; const parsedName2 = parser(nameString2); console.log('\nParsed name 2:'); console.log(parsedName2); /* Output: { prefix: null, first: 'James', middle: 'W.', last: 'Gordon', suffix: null, original: 'Gordon, James W.' } */
Debug
Known issues
gotchaThe release `v0.1.0` which added TypeScript support was incorrectly tagged as `v0.10.0` in the changelog and GitHub release notes. The actual package version on npm remains `0.1.0`.
fix
Refer to the npm registry for the correct version number. If referencing git tags, be aware of this discrepancy for `v0.1.0`.
affects: >=0.1.0
gotchaThis library is designed primarily for US English name conventions. While it might work for some international names, its rules for prefixes, suffixes, and compound names are tailored to common Western patterns and may produce incorrect results for other cultures.
fix
Test thoroughly with names from diverse backgrounds if using outside of US English contexts. Consider alternative libraries for broader international name parsing.
affects: >=0.0.1
gotchaThe library is still in a pre-1.0 state (version `0.1.0`), meaning its API might not be fully stable and could introduce breaking changes in minor versions, though this is not explicitly stated. Developers should exercise caution with dependency ranges.
fix
Pin exact versions (`"another-name-parser": "0.1.0"`) or use caret ranges cautiously (`"^0.1.0"`) after thorough testing. Monitor release notes for any API changes.
affects: >=0.0.1
Errors
Common errors & fixes
TypeError: another_name_parser_1.default is not a function
Attempting to import `another-name-parser` as a default export in a pure CommonJS environment or when the bundler/runtime doesn't correctly resolve `module.exports` to a default export.
fix
In CommonJS, use `const parser = require('another-name-parser');`. If using ESM syntax in a setup that still treats it as CJS, ensure your build tools (e.g., Babel, TypeScript) or Node.js runtime (`type: module` in `package.json`) are configured correctly for ESM interoperability, or stick to `require`.
Name contains a nickname (e.g., 'John "Johnny" Doe') but the parser is not extracting 'Johnny'.
The parser's design explicitly ignores quoted or parenthesized nicknames, treating them as extraneous information not part of the formal name components.
fix
This is intended behavior. If you need to retain or extract nicknames, this library may not be suitable, or you would need to pre-process the name string before passing it to the parser.
Upgrade
Version history
0.1.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
38 hits · last 30 days
node
32
OpenAI (training)
3
Resources
another-name-parser — npm install another-name-parser · libregistry