Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
parse-full-name
Advanced tools
A function that accepts the full name of a person in any format, parses it, and returns its parts { title, first name, middle name, last name, nickname, suffix, [and any parsing errors] }.
parseFullName() is designed to parse large batches of full names in multiple inconsistent formats, as from a database, and continue processing without error, even if given some unparsable garbage entries.
parseFullName():
Optionally, parseFullName() can also:
If this is not what you're looking for, is overkill for your application, or is in the wrong language, check the "Credits" section at the end of this file for links to several other excellent parsers which may suit your needs better.
var parseFullName = require('parse-full-name').parseFullName;
name = parseFullName('Mr. David Davis');
assert.strictEqual(name.title, 'Mr.');
assert.strictEqual(name.first, 'David');
assert.strictEqual(name.last, 'Davis');
parseFullName(nameToParse, partToReturn, fixCase, stopOnError, useLongLists)
nameToParse (string, required): the name to be parsed
partToReturn (string, optional): the name of a single part to return
fixCase (integer, optional): fix case of output name
stopOnError (integer, optional): makes parsing errors throw JavaScript errors
useLongLists (integer, optional): use long prefix, suffix, and title lists
var parseFullName = require('parse-full-name').parseFullName;
name = parseFullName('DE LORENZO Y GUTIEREZ, Mr. JÜAN MARTINEZ (MARTIN) Jr.','all',1,0,0);
assert.strictEqual(name.title, 'Mr.');
assert.strictEqual(name.first, 'Jüan');
assert.strictEqual(name.middle, 'Martinez');
assert.strictEqual(name.last, 'de Lorenzo y Gutierez');
assert.strictEqual(name.nick, 'Martin');
assert.strictEqual(name.suffix, 'Jr.');
assert.strictEqual(name.error, []);
If you find a name this function does not parse correctly, or any other bug, please report it here: https://github.com/dschnelldavis/parse-full-name/issues
Before creating this function I studied many other name-parsing functions. None quite suited my needs, but many are excellent at what they do, and this function uses ideas from several of them.
My thanks to all the following developers for sharing their work.
"If I have seen further, it is by standing on the shoulders of giants." — Isaac Newton
Josh Fraser's PHP-Name-Parser: https://github.com/joshfraser/PHP-Name-Parser
Josh Fraser's JavaScript-Name-Parser: https://github.com/joshfraser/JavaScript-Name-Parser
Garve Hays' Java NameParser: https://github.com/gkhays/NameParser
Jason Priem's PHP HumanNameParser: https://web.archive.org/web/20150408022642/http://jasonpriem.org/human-name-parse/ and https://github.com/jasonpriem/HumanNameParser.php
Keith Beckman's PHP nameparse: http://alphahelical.com/code/misc/nameparse/
Jed Hartman's PHP normalize_name: http://www.kith.org/journals/jed/2007/02/11/3813.html and http://www.kith.org/logos/things/code/name-parser-php.html
ashaffer88's JavaScript parse-name: https://github.com/weo-edu/parse-name and https://www.npmjs.com/package/parse-name
Derek Gulbranson's Python nameparser: https://github.com/derek73/python-nameparser/
Discussion about how to change all upper or lowercase names to correct case: http://stackoverflow.com/questions/11529213/given-upper-case-names-transform-to-proper-case-handling-ohara-mcdonald
Title lists modified from: http://www.codeproject.com/Questions/262876/Titles-or-Salutation-list
Suffix lists modified from: http://en.wikipedia.org/wiki/Suffix_(name) and https://github.com/derek73/python-nameparser/blob/master/nameparser/config/suffixes.py
Prefix lists modified from: http://en.wikipedia.org/wiki/List_of_family_name_affixes
Conjunction list copied entirely from: https://github.com/derek73/python-nameparser/blob/master/nameparser/config/conjunctions.py
FAQs
A function that accepts the full name of a person in any format, parses it, and returns its parts { title, first name, middle name, last name, nickname, suffix, [and any parsing errors] }.
The npm package parse-full-name receives a total of 38,876 weekly downloads. As such, parse-full-name popularity was classified as popular.
We found that parse-full-name demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.