# mention-parser

> Parse and replace mentions from string

Latest version **0.0.1** (published 2017-08-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install mention-parser
pnpm add mention-parser
yarn add mention-parser
bun add mention-parser
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2017-08-21 |
| First published | 2017-08-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Bu Kinoshita |
| Maintainers | bukinoshita |
| Keywords | mention, mentions, parse, parser, user |

## Links

- npm: https://www.npmjs.com/package/mention-parser
- Repository: https://github.com/bukinoshita/mention-parser
- Homepage: https://github.com/bukinoshita/mention-parser#readme
- Issues: https://github.com/bukinoshita/mention-parser/issues
- npm.io page: https://npm.io/package/mention-parser

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 0.0.1 (latest) — 2017-08-21

## README

# mention-parser [![Build Status](https://travis-ci.org/bukinoshita/mention-parser.svg?branch=master)](https://travis-ci.org/bukinoshita/mention-parser)

> Parse and replace mentions from string


## Install

```bash
$ yarn add mention-parser
```


## Usage

```js
const mentionParser = require('mention-parser')

const str = 'hey @bukinoshita and @here, check this #channel!'

mentionParser(str).get()
// => ['@bukinoshita', '@here']

mentionParser(str, { prefix: '#' }).get()
// => ['#channel']

mentionParser(str).replace(mention => `<a href="/channel">${mention}</a>`)
// => 'hey <a href="/bukinoshita">@bukinoshita</a> and <a href="/here">@here</a>, check this #channel!'
```


## API

### mentionParser(input, [options])

#### input

Type: `string`<br/>
Required

string to be parsed

#### options

Type: `object`

##### prefix

Type: `string`<br/>
Default: `@`<br/>
Options: `@` or `#`

### methods

#### .get()

Returns an `array` with mentions

#### .replace(fn)

##### fn

Type: `function`


## License

MIT © [Bu Kinoshita](https://bukinoshita.io)

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