0.0.1 • Published 8 years ago

name-suffixes v0.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
8 years ago

name-suffixes NPM version Build Status Dependency Status Coverage percentage

Identify name suffixes

For the most part, this is just the code version of the Wikipedia page on name suffixes. Each suffix has three parts: a list of variants, which is a list of all of the versions of the same suffix that differ in more than punctation, whitespace, or capitalization; a canonical version, which is a standard way of identifying a single suffix, and a type, which is one of: generational, academic, professional or religious.

Installation

$ npm install --save name-suffixes

Usage

var nameSuffixes = require('name-suffixes').suffixes;

nameSuffixes.forEach(suffix => {
  console.log(suffix.variants); // ['Jr', 'II', 'Junior']
  console.log(suffix.canonical); // 'Jr'
  console.log(suffix.type); // generational
});

var isSuffix = require('nameSuffixes').isSuffix;

console.log(isSuffix('Sr')); // true
console.log(isSuffix('Wade')); // false

var canonize = require('nameSuffixes').canonize;

console.log(canonize('II')); // { variants: ['Jr', 'II', 'Junior'], canonical: 'jr', type: 'generational' }
console.log(canonize('Wade')); // undefined

License

MIT © Doug Wade