* Tests whether the input string is a valid NPM package name.
(packageName: string)
| 124 | * Tests whether the input string is a valid NPM package name. |
| 125 | */ |
| 126 | public static explainIfInvalidPackageName(packageName: string): string | undefined { |
| 127 | if (packageName.length === 0) { |
| 128 | return 'The package name cannot be an empty string'; |
| 129 | } |
| 130 | |
| 131 | if (!StringChecks._validPackageNameRegExp.test(packageName)) { |
| 132 | return `The package name ${JSON.stringify(packageName)} is not a valid package name`; |
| 133 | } |
| 134 | |
| 135 | return undefined; |
| 136 | } |
| 137 | |
| 138 | /** |
| 139 | * Tests whether the input string is a valid declaration reference import path. |
no outgoing calls
no test coverage detected