source: imaps-frontend/node_modules/babel-plugin-polyfill-corejs2/lib/helpers.js

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

F4 Finalna Verzija

  • Property mode set to 100644
File size: 1.5 KB
RevLine 
[79a0317]1"use strict";
2
3exports.__esModule = true;
4exports.hasMinVersion = hasMinVersion;
5var _semver = _interopRequireDefault(require("semver"));
6function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
7function hasMinVersion(minVersion, runtimeVersion) {
8 // If the range is unavailable, we're running the script during Babel's
9 // build process, and we want to assume that all versions are satisfied so
10 // that the built output will include all definitions.
11 if (!runtimeVersion || !minVersion) return true;
12 runtimeVersion = String(runtimeVersion);
13
14 // semver.intersects() has some surprising behavior with comparing ranges
15 // with preprelease versions. We add '^' to ensure that we are always
16 // comparing ranges with ranges, which sidesteps this logic.
17 // For example:
18 //
19 // semver.intersects(`<7.0.1`, "7.0.0-beta.0") // false - surprising
20 // semver.intersects(`<7.0.1`, "^7.0.0-beta.0") // true - expected
21 //
22 // This is because the first falls back to
23 //
24 // semver.satisfies("7.0.0-beta.0", `<7.0.1`) // false - surprising
25 //
26 // and this fails because a prerelease version can only satisfy a range
27 // if it is a prerelease within the same major/minor/patch range.
28 //
29 // Note: If this is found to have issues, please also revist the logic in
30 // babel-core's availableHelper() API.
31 if (_semver.default.valid(runtimeVersion)) runtimeVersion = `^${runtimeVersion}`;
32 return !_semver.default.intersects(`<${minVersion}`, runtimeVersion) && !_semver.default.intersects(`>=8.0.0`, runtimeVersion);
33}
Note: See TracBrowser for help on using the repository browser.