MCPcopy Create free account
hub / github.com/npmx-dev/npmx.dev / isKnownDevDependencyPackage

Function isKnownDevDependencyPackage

shared/utils/dev-dependency.ts:44–60  ·  view source on GitHub ↗
(packageName: string)

Source from the content-addressed store, hash-verified

42]
43
44function isKnownDevDependencyPackage(packageName: string): boolean {
45 const normalized = packageName.toLowerCase()
46 if (normalized.startsWith('@types/')) {
47 return true
48 }
49 // Match scoped packages by name segment, e.g. @scope/eslint-config
50 const namePart = normalized.includes('/') ? normalized.split('/').pop() : normalized
51 if (!namePart) return false
52
53 return (
54 KNOWN_DEV_DEPENDENCY_PACKAGES.has(normalized) ||
55 KNOWN_DEV_DEPENDENCY_PACKAGES.has(namePart) ||
56 KNOWN_DEV_DEPENDENCY_PACKAGE_PREFIXES.some(prefix =>
57 prefix.startsWith('@') ? normalized.startsWith(prefix) : namePart.startsWith(prefix),
58 )
59 )
60}
61
62function escapeRegExp(text: string): string {
63 return text.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected