mentions

1.0.2 • Public • Published

mentions

Get user mentions from string or replace user mentions with something else.

Install the module with npm:

$ npm install mentions

or with Bower, with AMD and browser support:

$ bower install mentions
$ node
> var mentions = require('mentions');
undefined
> mentions('hello @frozzare').get()
['@frozzare']
> mentions('hello @frozzare ping @user').get()
['@frozzare', '@user']
> mentions('hello @frozzare ping @user').replace(function (mention) {
    return '<a href="http://twitter.com/' + mention.substr(1) + '">' + mention + '</a>';
  });
> 'hello <a href="http://twitter.com/frozzare">@frozzare</a> ping <a href="http://twitter.com/user">@user</a>'

License

Copyright (c) 2014 Fredrik Forsmo
Licensed under the MIT license.

Readme

Keywords

Package Sidebar

Install

npm i mentions

Weekly Downloads

46

Version

1.0.2

License

MIT

Last publish

Collaborators

  • frozzare