humanparser
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/humanparser package

2.7.0 • Public • Published

humanparser

NPM

Parse a human name string into salutation, first name, middle name, last name, suffix.

Install

npm install humanparser

Usage

const human = require('humanparser');

parse human name

const fullName = 'Mr. William R. Hearst, III';
const attrs = human.parseName(fullName);

console.log(attrs);

//produces the following output

{ 
    salutation: 'Mr.',
    firstName: 'William',
    suffix: 'III',
    lastName: 'Hearst',
    middleName: 'R.',
    fullName: 'Mr. William R. Hearst, III'
}

get fullest name in string

const name = 'John & Peggy Sue';
const fullName = human.getFullestName(name);

//produces the following output
{
    fullName: 'Peggy Sue'
}

parse address

const address = '123 Happy Street, Honolulu, HI  65780';
const parsed = human.parseAddress(address);

//produces the following output    
{
    address: '123 Happy Street',
    city: 'Honolulu',
    state: 'HI',
    zip: '65780',
    fullAddress: '123 Happy Street, Honolulu, HI  65780'
}

Dependencies (0)

    Dev Dependencies (3)

    Package Sidebar

    Install

    npm i humanparser

    Weekly Downloads

    25,549

    Version

    2.7.0

    License

    MIT

    Unpacked Size

    19.7 kB

    Total Files

    8

    Last publish

    Collaborators

    • chovy