本文整理汇总了TypeScript中semver.intersects函数的典型用法代码示例。如果您正苦于以下问题:TypeScript intersects函数的具体用法?TypeScript intersects怎么用?TypeScript intersects使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了intersects函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: functionsSDKTooOld
function functionsSDKTooOld(loaded: any): boolean {
const SDKRange = _.get(loaded, "dependencies.firebase-functions");
try {
if (!semver.intersects(SDKRange, ">=2")) {
return true;
}
} catch (e) {
// do nothing
}
return false;
}
示例2: mergeMap
mergeMap(({version, depName, depVersion, npmPackageJson}) => {
const updateVersion = _getVersionFromNpmPackage(npmPackageJson, version, loose);
const npmPackageVersions = Object.keys(npmPackageJson['versions'] as JsonObject);
const match = semver.maxSatisfying(npmPackageVersions, updateVersion);
if (!match) {
return EMPTY;
}
if (semver.lt(
semverIntersect.parseRange(updateVersion).version,
semverIntersect.parseRange(depVersion).version)
) {
throw new SchematicsException(`Cannot downgrade package ${
JSON.stringify(depName)} from version "${depVersion}" to "${updateVersion}".`,
);
}
const innerNpmPackageJson = (npmPackageJson['versions'] as JsonObject)[match] as JsonObject;
const dependencies: { [name: string]: string } = {};
const deps = innerNpmPackageJson['peerDependencies'] as JsonObject;
if (deps) {
for (const depName of Object.keys(deps)) {
dependencies[depName] = deps[depName] as string;
}
}
logger.debug(`Recording update for ${JSON.stringify(depName)} to version ${updateVersion}.`);
if (allVersions[depName]) {
if (!semver.intersects(allVersions[depName], updateVersion)) {
throw new SchematicsException(
'Cannot update safely because packages have conflicting dependencies. Package '
+ `${depName} would need to match both versions "${updateVersion}" and `
+ `"${allVersions[depName]}, which are not compatible.`,
);
}
allVersions[depName] = semverIntersect.intersect(allVersions[depName], updateVersion);
} else {
allVersions[depName] = updateVersion;
}
return _getRecursiveVersions(
packageJson,
dependencies,
allVersions,
logger,
loose,
);
}),
示例3:
comparatorResult = semver.rcompare(v1, v2, loose);
comparatorResult = semver.compareIdentifiers(str, str);
comparatorResult = semver.rcompareIdentifiers(str, str);
versionsArr = semver.sort(['', new semver.SemVer('')]);
versionsArr = semver.rsort(['', new semver.SemVer('')]);
diff = semver.diff(v1, v2, loose);
// Ranges
str = semver.validRange(str, loose);
bool = semver.satisfies(version, str, loose);
str = semver.maxSatisfying(versions, str, loose);
str = semver.minSatisfying(versions, str, loose);
bool = semver.gtr(version, str, loose);
bool = semver.ltr(version, str, loose);
bool = semver.outside(version, str, '<', loose);
bool = semver.intersects(str, str, loose);
let ver = new semver.SemVer(str, bool);
str = ver.raw;
bool = ver.loose;
str = ver.format();
str = ver.inspect();
str = ver.toString();
num = ver.major;
num = ver.minor;
num = ver.patch;
str = ver.version;
strArr = ver.build;
strArr = ver.prerelease;