scoped-regex

Regular expression for matching scoped npm package names

MIT 4 个版本
安装
npm install scoped-regex
yarn add scoped-regex
pnpm add scoped-regex
bun add scoped-regex
README

scoped-regex

Regular expression for matching scoped npm package names

Install

$ npm install scoped-regex

Usage

import scopedRegex from 'scoped-regex';

scopedRegex({exact: true}).test('@sindresorhus/df');
//=> true

'foo @sindresorhus/df bar'.match(scopedRegex());
//=> ['@sindresorhus/df']

API

scopedRegex(options?)

Returns a RegExp for matching scoped package names.

options

Type: object

exact

Type: boolean
Default: false (Matches any scoped package names in a string)

Only match an exact string. Useful with RegExp#test() to check if a string is a scoped package name.

  • is-scoped - Check if a string is a scoped npm package name
版本列表
3.0.0 2021-04-17
2.1.0 2019-04-04
2.0.0 2019-03-11
1.0.0 2017-03-22