source: imaps-frontend/node_modules/@babel/helper-compilation-targets/lib/utils.js

main
Last change on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 1.9 KB
Line 
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.getHighestUnreleased = getHighestUnreleased;
7exports.getLowestImplementedVersion = getLowestImplementedVersion;
8exports.getLowestUnreleased = getLowestUnreleased;
9exports.isUnreleasedVersion = isUnreleasedVersion;
10exports.semverMin = semverMin;
11exports.semverify = semverify;
12var _semver = require("semver");
13var _helperValidatorOption = require("@babel/helper-validator-option");
14var _targets = require("./targets.js");
15const versionRegExp = /^(?:\d+|\d(?:\d?[^\d\n\r\u2028\u2029]\d+|\d{2,}(?:[^\d\n\r\u2028\u2029]\d+)?))$/;
16const v = new _helperValidatorOption.OptionValidator("@babel/helper-compilation-targets");
17function semverMin(first, second) {
18 return first && _semver.lt(first, second) ? first : second;
19}
20function semverify(version) {
21 if (typeof version === "string" && _semver.valid(version)) {
22 return version;
23 }
24 v.invariant(typeof version === "number" || typeof version === "string" && versionRegExp.test(version), `'${version}' is not a valid version`);
25 version = version.toString();
26 let pos = 0;
27 let num = 0;
28 while ((pos = version.indexOf(".", pos + 1)) > 0) {
29 num++;
30 }
31 return version + ".0".repeat(2 - num);
32}
33function isUnreleasedVersion(version, env) {
34 const unreleasedLabel = _targets.unreleasedLabels[env];
35 return !!unreleasedLabel && unreleasedLabel === version.toString().toLowerCase();
36}
37function getLowestUnreleased(a, b, env) {
38 const unreleasedLabel = _targets.unreleasedLabels[env];
39 if (a === unreleasedLabel) {
40 return b;
41 }
42 if (b === unreleasedLabel) {
43 return a;
44 }
45 return semverMin(a, b);
46}
47function getHighestUnreleased(a, b, env) {
48 return getLowestUnreleased(a, b, env) === a ? b : a;
49}
50function getLowestImplementedVersion(plugin, environment) {
51 const result = plugin[environment];
52 if (!result && environment === "android") {
53 return plugin.chrome;
54 }
55 return result;
56}
57
58//# sourceMappingURL=utils.js.map
Note: See TracBrowser for help on using the repository browser.