MCPcopy Index your code
hub / github.com/TypeStrong/ts-node / versionGteLt

Function versionGteLt

src/util.ts:174–198  ·  view source on GitHub ↗
(
  version: string,
  gteRequirement: string,
  ltRequirement?: string
)

Source from the content-addressed store, hash-verified

172
173/** @internal */
174export function versionGteLt(
175 version: string,
176 gteRequirement: string,
177 ltRequirement?: string
178) {
179 const [major, minor, patch, extra] = parse(version);
180 const [gteMajor, gteMinor, gtePatch] = parse(gteRequirement);
181 const isGte =
182 major > gteMajor ||
183 (major === gteMajor &&
184 (minor > gteMinor || (minor === gteMinor && patch >= gtePatch)));
185 let isLt = true;
186 if (ltRequirement) {
187 const [ltMajor, ltMinor, ltPatch] = parse(ltRequirement);
188 isLt =
189 major < ltMajor ||
190 (major === ltMajor &&
191 (minor < ltMinor || (minor === ltMinor && patch < ltPatch)));
192 }
193 return isGte && isLt;
194
195 function parse(requirement: string) {
196 return requirement.split(/[\.-]/).map((s) => parseInt(s, 10));
197 }
198}

Callers 11

phase4Function · 0.90
requireResolveNonCachedFunction · 0.90
getExtendsConfigPathFunction · 0.90
esm.tsFile · 0.90
getExtensionsFunction · 0.90
callInChildFunction · 0.90
createResolveFunction · 0.85

Calls 1

parseFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…