Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

package-name-regex

dword-design317kMIT4.0.0TypeScript support: included

Provides a regex that can be used to test if a string is a valid NPM package name.

match, name, package, regex, regexp, test, validate

readme

package-name-regex

npm version Linux macOS Windows compatible Build status Coverage status Dependency status Renovate enabled
Open in Gitpod Buy Me a Coffee PayPal Patreon

Provides a regex that can be used to test if a string is a valid NPM package name.

Install

# npm
$ npm install package-name-regex

# Yarn
$ yarn add package-name-regex

Usage

import packageNameRegex from 'package-name-regex'
// Or import { packageNameRegex } from 'package-name-regex'

packageNameRegex.test('some-package') // true
packageNameRegex.test('example.com') // true
packageNameRegex.test('@npm/thingy') // true

packageNameRegex.test('crazy!') // false
packageNameRegex.test('.start-with-period') // false
packageNameRegex.test('@npm-zors/money!time.js') // false

Contribute

Are you missing something or want to contribute? Feel free to file an issue or a pull request! ⚙️

Support

Hey, I am Sebastian Landwehr, a freelance web developer, and I love developing web apps and open source packages. If you want to support me so that I can keep packages up to date and build more helpful tools, you can donate here:

Buy Me a Coffee  If you want to send me a one time donation. The coffee is pretty good 😊.
PayPal  Also for one time donations if you like PayPal.
Patreon  Here you can support me regularly, which is great so I can steadily work on projects.

Thanks a lot for your support! ❤️

License

MIT License © Sebastian Landwehr

changelog

4.0.0 (2024-03-04)

Bug Fixes

BREAKING CHANGES

  • node.js >= 18

3.1.1 (2023-11-23)

Bug Fixes

3.1.0 (2023-11-22)

Features

3.0.0 (2023-04-09)

Bug Fixes

BREAKING CHANGES

  • drop node 12 support, move to esm

2.0.6 (2022-01-12)

Bug Fixes

2.0.5 (2021-12-28)

Bug Fixes

2.0.4 (2021-07-20)

Bug Fixes

2.0.3 (2021-07-06)

Bug Fixes

2.0.2 (2021-06-14)

Bug Fixes

2.0.1 (2021-05-28)

Bug Fixes

2.0.0 (2021-05-03)

Bug Fixes

  • update dependency @dword-design/base to v8 (#38) (bd1f02d)

BREAKING CHANGES

  • require Node.js >= 12

Co-authored-by: Renovate Bot bot@renovateapp.com Co-authored-by: Sebastian Landwehr info@dword-design.de Co-authored-by: GitHub Actions actions@github.com

1.0.14 (2021-04-20)

Bug Fixes

1.0.13 (2021-04-12)

Bug Fixes

1.0.12 (2021-03-31)

Bug Fixes

1.0.11 (2021-03-23)

Bug Fixes

1.0.10 (2021-03-17)

Bug Fixes

1.0.9 (2021-02-16)

Bug Fixes

  • deps: update dependency @dword-design/base to v7 (#23) (a2bd0a9)

1.0.8 (2020-02-19)

Bug Fixes