Home > @rushstack/node-core-library > PackageNameParser
PackageNameParser class
A configurable parser for validating and manipulating NPM package names such as my-package or @scope/my-package.
Signature:
export declare class PackageNameParser
Remarks
If you do not need to customize the parser configuration, it is recommended to use PackageName which exposes these operations as a simple static class.
Constructors
Constructor | Modifiers | Description |
|---|---|---|
Constructs a new instance of the |
Methods
Method | Modifiers | Description |
|---|---|---|
Combines an optional package scope with an unscoped root name. | ||
The parsed NPM scope, or an empty string if there was no scope. The scope value will always include the at-sign. | ||
The parsed NPM package name without the scope. | ||
Returns true if the specified package name is valid, or false otherwise. | ||
Same as PackageName.tryParse(), except this throws an exception if the input cannot be parsed. | ||
This attempts to parse a package name that may include a scope component. The packageName must not be an empty string. | ||
Throws an exception if the specified name is not a valid package name. The packageName must not be an empty string. |