data_sanitize-locale.js

/**
 * @function sanitizeLocale
 * @description Sanitizes a locale string by replacing underscores with hyphens.
 *
 * @since 4.0.8
 *
 * @param {string} locale The locale string to sanitize.
 *
 * @return {string} The sanitized locale string.
 */
const sanitizeLocale = ( locale = '' ) => {
	return locale.replace( /_/g, '-' );
};

export default sanitizeLocale;