當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript semver.ltr函數代碼示例

本文整理匯總了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;
		});
開發者ID:Bolisov,項目名稱:vscode-yo,代碼行數:41,代碼來源:yo.ts

示例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;
開發者ID:PriceSpider-NeuIntel,項目名稱:DefinitelyTyped,代碼行數:31,代碼來源:semver-tests.ts


注:本文中的semver.ltr函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。