source: trip-planner-front/node_modules/@babel/helper-compilation-targets/lib/pretty.js@ fa375fe

Last change on this file since fa375fe was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 950 bytes
Line 
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.prettifyVersion = prettifyVersion;
7exports.prettifyTargets = prettifyTargets;
8
9var _semver = require("semver");
10
11var _targets = require("./targets");
12
13function prettifyVersion(version) {
14 if (typeof version !== "string") {
15 return version;
16 }
17
18 const parts = [_semver.major(version)];
19
20 const minor = _semver.minor(version);
21
22 const patch = _semver.patch(version);
23
24 if (minor || patch) {
25 parts.push(minor);
26 }
27
28 if (patch) {
29 parts.push(patch);
30 }
31
32 return parts.join(".");
33}
34
35function prettifyTargets(targets) {
36 return Object.keys(targets).reduce((results, target) => {
37 let value = targets[target];
38 const unreleasedLabel = _targets.unreleasedLabels[target];
39
40 if (typeof value === "string" && unreleasedLabel !== value) {
41 value = prettifyVersion(value);
42 }
43
44 results[target] = value;
45 return results;
46 }, {});
47}
Note: See TracBrowser for help on using the repository browser.