MCPcopy Index your code
hub / github.com/microsoft/tsdoc / explainIfInvalidPackageName

Method explainIfInvalidPackageName

tsdoc/src/parser/StringChecks.ts:126–136  ·  view source on GitHub ↗

* Tests whether the input string is a valid NPM package name.

(packageName: string)

Source from the content-addressed store, hash-verified

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.

Callers 4

registerDocNodesMethod · 0.80
_fromPackageNameMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected