<commit_before>/**
 * Remove quotes around given string.
 *
 * @param {string} string
 * @returns {string}
 */
export function unquote(string) {
	return string.replace(/^['"]|['"]$/g, '');
}

/**
 * Return prop type object.
 *
 * @param {object} prop
 * @returns {object}
 */
export function getType(prop) {
	if (prop.flowType) {
		if (
			prop.flowType.name === 'union' &&
			prop.flowType.elements.every(elem => elem.name === 'literal')
		) {
			return {
				...prop.flowType,
				name: 'enum',
				value: prop.flowType.elements,
			};
		}
		return prop.flowType;
	}
	return prop.type;
}

/**
 * Show starting and ending whitespace around given string.
 *
 * @param {string} string
 * @returns {string}
 */
export function showSpaces(string) {
	return string.replace(/^\s|\s$/g, '␣');
}<commit_msg>Fix: Do not explode when on null in replace (#1115)<commit_after>/**
 * Remove quotes around given string.
 *
 * @param {string} string
 * @returns {string}
 */
export function unquote(string) {
	return string && string.replace(/^['"]|['"]$/g, '');
}

/**
 * Return prop type object.
 *
 * @param {object} prop
 * @returns {object}
 */
export function getType(prop) {
	if (prop.flowType) {
		if (
			prop.flowType.name === 'union' &&
			prop.flowType.elements.every(elem => elem.name === 'literal')
		) {
			return {
				...prop.flowType,
				name: 'enum',
				value: prop.flowType.elements,
			};
		}
		return prop.flowType;
	}
	return prop.type;
}

/**
 * Show starting and ending whitespace around given string.
 *
 * @param {string} string
 * @returns {string}
 */
export function showSpaces(string) {
	return string && string.replace(/^\s|\s$/g, '␣');
}
{'fraction_non_alphanumeric': 0.18455971049457176, 'fraction_numerical': 0.0024125452352231603, 'mean_word_length': 3.2979274611398965, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3210913', 'n_tokens_mistral': 617, 'n_tokens_neox': 567, 'n_words': 141}