MCPcopy Index your code
hub / github.com/npmx-dev/npmx.dev / checkPackageExists

Function checkPackageExists

app/utils/package-name.ts:82–95  ·  view source on GitHub ↗
(
  name: string,
  options: Parameters<typeof $fetch>[1] = {},
)

Source from the content-addressed store, hash-verified

80}
81
82export async function checkPackageExists(
83 name: string,
84 options: Parameters<typeof $fetch>[1] = {},
85): Promise<boolean> {
86 try {
87 await $fetch(`${NPM_REGISTRY}/${encodePackageName(name)}`, {
88 ...options,
89 method: 'HEAD',
90 })
91 return true
92 } catch {
93 return false
94 }
95}
96
97export async function findSimilarPackages(
98 name: string,

Callers 3

checkPackageNameFunction · 0.85
validateSuggestionsNpmFunction · 0.85

Calls 1

encodePackageNameFunction · 0.90

Tested by

no test coverage detected