@opengis/fastify-table
Version:
core-plugins
24 lines (20 loc) • 686 B
JavaScript
import L from './utils/alphabet.js';
/**
* Форматування символів з кирилиці на латиницю
*
* @summary Форматування символів з кирилиці на латиницю
* @priority 0
* @deprecated true
* @tag string
* @type helper
* @alias translit
* @example
* {{translit data_name}}
* @param {String} data Перетворення букв з строки з укр на англ
* @returns {String} Returns HTML
*/
export default function translit({ data }) {
const rKey = Object.keys(L).join('');
const reg = new RegExp(`[${rKey}]`, 'g');
return (data || '').replace(reg, (a) => (a in L ? L[a] : ''));
};