json-parser-yaml-converter
Version:
Enhanced JSON Parser with verbose error messages and JSON to YAML conversion
19 lines (15 loc) • 437 B
JavaScript
/**
* This module contains some util functions to tests.
*
* @module utils
*/
;
/**
* This function removes colors and newlines from a string.
* @param {string} string - The string to clean.
* @returns {string} The cleaned string.
*/
function cleanString(string) {
return string.replace(/\u001b\[\d+m/g, '').replace(/\r\n/g, '').replace(/\n/g, '').replace(/\r/g, '');
}
export { cleanString };