collect-mentions !npm versionnpmv-imgnpmv-url !github releaseghrelease-imgghrelease-url !Licenselicense-imglicense-url
Collect mentions from a given text string, using battle-tested mentions-regex package
!XAXA code stylecodestyle-imgcodestyle-url !CircleCI linux buildlinuxbuild-imglinuxbuild-url !CodeCov coverage statuscodecoverage-imgcodecoverage-url !DavidDM dependency statusdependencies-imgdependencies-url !Renovate App Statusrenovateapp-imgrenovateapp-url !Make A Pull Requestprs-welcome-imgprs-welcome-url !Semantically Releasednew-release-imgnew-release-url
If you have any how-to kind of questions, please read the Contributing Guide and Code of Conduct documents.
For bugs reports and feature requests, please create an issueopen-issue-url or ping @tunnckoCore at Twitter.
!Conventional Commitsccommits-imgccommits-url !PayPal Author Supportpaypal-donate-imgpaypal-donate-url !Share Love Tweetsharebshareu !NPM Downloads Weeklydownloads-weekly-imgnpmv-url !NPM Downloads Monthlydownloads-monthly-imgnpmv-url !NPM Downloads Totaldownloads-total-imgnpmv-url
Project is semantically & automatically released on CircleCIcodecoverage-url with new-release and its New Release GitHub App.
Table of Contents
collectMentionsInstall
This project requires Node.js ^6.9.0 || ^8.9.0 || ^10.6.0. Install it using yarn or npm.We highly recommend to use Yarn when you think to contribute to this project.
$ yarn add collect-mentions
API
collectMentions
Collect all mentions from string. Returns array of objects with properties { handle, mention, index }
.
Params
str
{String}: string to collect mentions fromdot
{Boolean}: if it istrue
, it will support mentions including dotreturns
{Array}: array of objects
Example
import collectMentions from 'collect-mentions';
const mentions = collectMentions('foo @tunnckoCore and yeah @bar, right?')
console.log(mentions)
// => [
// { handle: '@tunnckoCore', mention: 'tunnckoCore', index: 3 },
// { handle: '@bar', mention: 'bar', index: 25 },
// ]
// If `dot` boolean is `true`
console.log(collectMentions('some @ok.bar yeah', true))
// => [{ handle: '@ok.bar', mention: 'ok.bar', index: 4 }]
back to top
Related Projects
Some of these projects are used here or were inspiration for this one, others are just related. So, thanks for your existance!- asia: Blazingly fast, magical and minimalist testing framework, for Today and Tomorrow | homepage
- charlike: Small, fast, simple and streaming project scaffolder for myself, but not… more | homepage
- gitcommit: Lightweight and joyful
git commit
replacement. Conventional Commits compliant. | homepage - new-release: A stable alternative to semantic-release. Only handles NPM publishing and nothing… more | homepage
- xaxa: Zero-config linting, powered by few amazing unicorns, AirBnB & Prettier. | homepage
back to top
Contributing
Please read the Contributing Guide and Code of Conduct documents for advices.For bugs reports and feature requests, please create an issueopen-issue-url or ping @tunnckoCore at Twitter.
Contributors
Thanks to the hard work of these wonderful people this project is alive and it also follows the all-contributors specification.Pull requests, stars and all kind of contributions are always welcome. :stars:
Users
You can see who usescollect-mentions
in the USERS.md file. Please feel free adding this file if it not exists.If you or your organization are using this project, consider adding yourself to the list of users.
Thank You! :heart:
License
Copyright (c) 2017-present, Charlike Mike Reagentauthor-link<olsten.larck@gmail.com>
.Released under the Apache-2.0 Licenselicense-url.
This file was generated by verb-generate-readme, v0.7.0, on July 25, 2018.