Skip to content
compwrightPublic
forked from emgee3/namecase

About

A Javascript library for fixing the capitalization of people's names.

Topics

Resources

Stars

4 stars

Watchers

1 watching

Forks

 
 

Latest commit

 

History

84 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@compwright/namecase

A Javascript library for fixing the capitalization of people's names.

It is heavily based on the Perl Lingua-EN-NameCase module.

Version 3.x is now an ESM module and requires Node.js 20.x

Usage

namecase provides two functions:

checkName() which returns true if the name is in all UPPERCASE or lowercase.

namecase(string or array, { individualFields: boolean }) returns a properly capitalized name.

The option individualFields defaults to false which works best when the person's names are combined into a single field. If individualFields is set to true, it means you're passing in given and surnames separately. The only difference between these two options is with individualFields set to false, the first character is always capitalized.

Code Example

import { namecase } from '@compwright/namecase';
console.log(namecase('WILLIAM MCKINLEY'));

Command line

Namecase can also be executed from the command line via namecase, which accepts data from STDIN and outputs the formatted names to STDOUT.

$ npm install -g @compwright/namecase
$ echo "jonathon hill" | bin/namecase

About

A Javascript library for fixing the capitalization of people's names.

Topics

Resources

Stars

4 stars

Watchers

1 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages