Home > @rushstack/node-core-library > PackageNameParser > tryParse

PackageNameParser.tryParse() method

This attempts to parse a package name that may include a scope component. The packageName must not be an empty string.

Signature:

tryParse(packageName: string): IParsedPackageNameOrError;

Parameters

Parameter Type Description
packageName string  

Returns:

IParsedPackageNameOrError

an IParsedPackageNameOrError structure whose error property will be nonempty if the string could not be parsed.

Remarks

This function will not throw an exception.