UNPKG

@microsoft/teams-ai

Version:

SDK focused on building AI based applications for Microsoft Teams.

68 lines 2.07 kB
"use strict"; /** * @module teams-ai */ /** * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.Colorize = void 0; const json_colorizer_1 = __importDefault(require("json-colorizer")); /** * @private */ class Colorize { static error(error) { if (typeof error === 'string') { return `\x1b[31;1m${error}\x1b[0m`; } else { return `\x1b[31;1m${error.message}\x1b[0m`; } } static output(output, quote = '', units = '') { if (typeof output === 'string') { return `\x1b[32m${quote}${output}${quote}\x1b[0m`; } else if (typeof output === 'object' && output !== null) { return (0, json_colorizer_1.default)(JSON.stringify(output), { pretty: true, colors: { BRACE: 'white', BRACKET: 'white', COLON: 'white', COMMA: 'white', STRING_KEY: 'white', STRING_LITERAL: 'green', NUMBER_LITERAL: 'blue', BOOLEAN_LITERAL: 'blue', NULL_LITERAL: 'blue' } }); } else if (typeof output == 'number') { return `\x1b[34m${output}${units}\x1b[0m`; } else { return `\x1b[34m${output}\x1b[0m`; } } static success(message) { return `\x1b[32;1m${message}\x1b[0m`; } static title(title) { return `\x1b[35;1m${title}\x1b[0m`; } static value(field, value, units = '') { return `${field}: ${Colorize.output(value, '"', units)}`; } static warning(warning) { return `\x1b[33m${warning}\x1b[0m`; } } exports.Colorize = Colorize; //# sourceMappingURL=Colorize.js.map