https://github.com/sidoshi/org-regex
Regular expression for matching npm organizations
https://github.com/sidoshi/org-regex
Last synced: about 2 months ago
JSON representation
Regular expression for matching npm organizations
- Host: GitHub
- URL: https://github.com/sidoshi/org-regex
- Owner: sidoshi
- License: mit
- Created: 2019-06-30T12:12:33.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-06-30T12:12:50.000Z (almost 6 years ago)
- Last Synced: 2025-04-01T14:21:14.358Z (about 2 months ago)
- Language: JavaScript
- Homepage:
- Size: 2.93 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# org-regex [](https://travis-ci.org/sidoshi/org-regex)
> Regular expression for matching [npm organizations](https://docs.npmjs.com/orgs/)
## Install
```
$ npm install org-regex
```## Usage
```js
const orgRegex = require('org-regex');orgRegex({exact: true}).test('@ava');
//=> true'foo @ava bar @ava/init'.match(orgRegex());
//=> ['@ava']
```## API
### orgRegex([options])
Returns a `RegExp` for matching npm organization names.
#### options
Type: `Object`
##### exact
Type: `boolean`
Default: `false` *(Matches any organization package names in a string)*Only match an exact string. Useful with `RegExp#test()` to check if a string is a scoped package name.
## Related
- [scoped-regex](https://github.com/sindresorhus/scoped-regex) - Check if a string is a scoped npm package name
## License
MIT © [Siddharth Doshi](https://sid.sh)