Skip to content

compwright/humanparser

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

82 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

humanparser

Build Status

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

Installation

$ npm install @compwright/humanparser --save

Usage

Parse human name

const human = require('@compwright/humanparser');
const fullName = 'Mr. William R. Hearst, III';
const attrs = human.parseName(fullName);

console.log(attrs);

Produces the following output:

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

Get fullest name in string

const human = require('@compwright/humanparser');
const name = 'John & Peggy Sue';
const fullName = human.getFullestName(name);

Produces the following output:

{
    fullName: 'Peggy Sue'
}

Parse address

const human = require('@compwright/humanparser');
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'
}

License

MIT License

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%