UNPKG

965 BJavaScriptView Raw
1'use strict';
2
3Object.defineProperty(exports, '__esModule', {
4 value: true
5});
6exports.default = printDisplayName;
7
8function _chalk() {
9 const data = _interopRequireDefault(require('chalk'));
10
11 _chalk = function () {
12 return data;
13 };
14
15 return data;
16}
17
18function _interopRequireDefault(obj) {
19 return obj && obj.__esModule ? obj : {default: obj};
20}
21
22/**
23 * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
24 *
25 * This source code is licensed under the MIT license found in the
26 * LICENSE file in the root directory of this source tree.
27 */
28function printDisplayName(config) {
29 const {displayName} = config;
30
31 const white = _chalk().default.reset.inverse.white;
32
33 if (!displayName) {
34 return '';
35 }
36
37 const {name, color} = displayName;
38 const chosenColor = _chalk().default.reset.inverse[color]
39 ? _chalk().default.reset.inverse[color]
40 : white;
41 return _chalk().default.supportsColor ? chosenColor(` ${name} `) : name;
42}