# name-counter

> Simple library to extract and count names from a supplied piece of text.

Latest version **1.0.3** (published 2018-09-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install name-counter
pnpm add name-counter
yarn add name-counter
bun add name-counter
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2018-09-27 |
| First published | 2018-09-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=8.12.0 |
| Dependencies | 0 |
| Unpacked size | 13 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Dan Young |
| Maintainers | joraz |

## Links

- npm: https://www.npmjs.com/package/name-counter
- npm.io page: https://npm.io/package/name-counter

## Recent versions

- 1.0.3 (latest) — 2018-09-27
- 1.0.2 — 2018-09-27
- 1.0.1 — 2018-09-26

## README

# name-counter

Simple library to extract and count names from a supplied piece of text.

## Usage

Exports a single function `countNames`, with the following signature:

```typescript
countNames(text: string, titles: string[], firstNames: string[], lastNames: string[]): Array<{ name: string, timesFound: number }>
```

| Param      | Type     | Description                                                 |
| ---------- | -------- | ----------------------------------------------------------- |
| text       | string   | The text to be searched through                             |
| titles     | string[] | Array of allowable titles (e.g. Mr, Mrs, Ms)                |
| firstNames | string[] | Array of allowable first names (also used for middle names) |
| lastNames  | string[] | Array of allowable last names                               |

## Example

```typescript
countNames('My name is Mr. Daniel Young and I like to code', ['Mr', 'Mrs'], ['Daniel', 'Danielle'], ['Young', 'Old']) // returns [{ name 'Mr Daniel Young', timesFound: 1}]
```

## Limitations

Does not support double-barreled last names.

---
_Source: https://npm.io/package/name-counter · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
