Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/doug-wade/name-suffixes
Identify name suffixes
https://github.com/doug-wade/name-suffixes
Last synced: 17 days ago
JSON representation
Identify name suffixes
- Host: GitHub
- URL: https://github.com/doug-wade/name-suffixes
- Owner: doug-wade
- License: mit
- Created: 2016-03-01T05:09:09.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2022-03-16T06:07:18.000Z (almost 3 years ago)
- Last Synced: 2024-11-20T07:27:48.304Z (about 2 months ago)
- Language: JavaScript
- Size: 148 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# name-suffixes [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][daviddm-image]][daviddm-url] [![Coverage percentage][coveralls-image]][coveralls-url]
[![Greenkeeper badge](https://badges.greenkeeper.io/doug-wade/name-suffixes.svg)](https://greenkeeper.io/)
> Identify name suffixesFor the most part, this is just the code version of the [Wikipedia page on name suffixes](https://en.wikipedia.org/wiki/Suffix_(name)). 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
```sh
$ npm install --save name-suffixes
```## Usage
```js
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')); // falsevar 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](dougwade.io)
[npm-image]: https://badge.fury.io/js/name-suffixes.svg
[npm-url]: https://npmjs.org/package/name-suffixes
[travis-image]: https://travis-ci.org/doug-wade/name-suffixes.svg?branch=master
[travis-url]: https://travis-ci.org/doug-wade/name-suffixes
[daviddm-image]: https://david-dm.org/doug-wade/name-suffixes.svg?theme=shields.io
[daviddm-url]: https://david-dm.org/doug-wade/name-suffixes
[coveralls-image]: https://coveralls.io/repos/doug-wade/name-suffixes/badge.svg
[coveralls-url]: https://coveralls.io/r/doug-wade/name-suffixes