UNPKG

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