@compwright/humanparser

1.8.2 • Public • Published

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

Package Sidebar

Install

npm i @compwright/humanparser

Weekly Downloads

2

Version

1.8.2

License

MIT

Unpacked Size

16.2 kB

Total Files

7

Last publish

Collaborators

  • compwright