UNPKG

perst

Version:

perst is a wrapper around LoaderIO, which can be configured and run in your commandline multiple tests and validates the measureable values like AVG Response Time and AVG Error Rate.

33 lines (28 loc) 832 B
import YAML from 'yaml'; import logger from '../logger.js'; import { highlight } from 'cli-highlight'; /** * * @param {Object} config * @return {Promise<number>} */ async function dumpConfig(config) { const format = config.dumpConfig; delete config.dumpConfig; if (format === 'json') { logger.log(highlight(JSON.stringify(config, null, 4), {language: 'json'})); } else if (format === 'js') { logger.log(highlight(`export default ${JSON.stringify(config, null, 4)}`, {language: 'javascript'})); } else { logger.log(highlight(YAML.stringify(config, { indent: 4, mapAsMap: true, merge: true, sortMapEntries: true, }), {language: 'yaml'})); } return 0; } export { dumpConfig as default };