本文整理汇总了TypeScript中semver.ltr函数的典型用法代码示例。如果您正苦于以下问题:TypeScript ltr函数的具体用法?TypeScript ltr怎么用?TypeScript ltr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ltr函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
list = list.map(key => {
const item = generatorsMeta[key];
const name = key.split(':')[0];
const pkgPath = readPkgUp.sync({cwd: item.resolved});
if (!pkgPath.pkg) {
return null;
}
const pkg = pkgPath.pkg;
const generatorVersion: any = pkg.dependencies['yeoman-generator'];
const generatorMeta: any = _.pick(pkg, 'name', 'version', 'description');
// Ignore the generator if does not depend on `yeoman-generator`
if (!generatorVersion) {
return null;
}
// Flag generator to indecate if the generator version is fully supported or not.
// https://github.com/yeoman/yeoman-app/issues/16#issuecomment-121054821
generatorMeta.isCompatible = semver.ltr('0.17.6', generatorVersion);
// Indicator to verify official generators
generatorMeta.officialGenerator = false;
if (generatorMeta.repository && generatorMeta.repository.url) {
generatorMeta.officialGenerator = generatorMeta.repository.url.indexOf('github.com/yeoman/') > -1;
}
// Add subgenerators
generatorMeta.subGenerators = Object.keys(generatorsMeta).reduce((result, key: any) => {
const split = key.split(':');
if (split[0] === name) {
result.push(split[1]);
}
return result;
}, []);
return generatorMeta;
});
示例2:
bool = semver.cmp(v1, op, v2, loose);
comparatorResult = semver.compare(v1, v2, loose);
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;