Have opinions about JavaScript? We want to hear them. Take the 2018 JavaScript Ecosystem Survey »

split-human-name

1.0.3 • Public • Published

split-human-name

Build Status Greenkeeper badge

Split a person's name into first name and last name fields

Features

  • Splits a name into exactly two fields { firstName, lastName }
  • Fixes UPPERCASE, lowercase, iNVERSE CASE, and otherwise FUnkY cAse
  • Handles couples ("John and Jane Doe")
  • Gracefully degrades to put the entire string in firstName if there are multiple last names

Based on the awesome humanparser and namecase packages

Online demo: http://compwright.com/demos/split-human-name

Requirements

  • Node.js 8+

Installation

$ npm install --save split-human-name

Usage

const splitName = require('split-human-name');
const { firstName, lastName } = splitName('John and Jane Doe');
assert.strictEquals(firstName, 'John and Jane');
assert.strictEquals(lastName, 'Doe');

License

MIT

install

npm i split-human-name

Downloadsweekly downloads

20

version

1.0.3

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability