Home > @microsoft/node-core-library > PackageName > tryParse

PackageName.tryParse() method

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

Signature:

static 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.