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

Function constraintIncludesPrerelease

server/utils/npm.ts:40–46  ·  view source on GitHub ↗

* Check if a version constraint explicitly includes a prerelease tag. * e.g., "^1.0.0-alpha" or ">=2.0.0-beta.1" include prereleases

(constraint: string)

Source from the content-addressed store, hash-verified

38 * e.g., "^1.0.0-alpha" or ">=2.0.0-beta.1" include prereleases
39 */
40function constraintIncludesPrerelease(constraint: string): boolean {
41 // Look for prerelease identifiers in the constraint
42 return (
43 /-(?:alpha|beta|rc|next|canary|dev|preview|pre|experimental)/i.test(constraint) ||
44 /-\d/.test(constraint)
45 ) // e.g., -0, -1
46}
47
48/**
49 * Resolve a semver version constraint to the best matching version.

Callers 1

resolveVersionConstraintFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected