Files
marco/app/utils/format-text.js
Râu Cao 200100686d
Some checks failed
CI / Lint (pull_request) Successful in 52s
CI / Test (pull_request) Failing after 56s
Optionally add tag to place photo
2026-06-05 18:24:36 +04:00

15 lines
477 B
JavaScript

export function humanizeOsmTag(text) {
if (typeof text !== 'string' || !text) return '';
// Replace underscores and dashes with spaces
const spaced = text.replace(/[_-]/g, ' ');
// Capitalize first letter of each word (Title Case)
return spaced.replace(/\w\S*/g, (w) =>
w.replace(/^\w/, (c) => c.toUpperCase())
);
}
export function capitalize(text) {
if (typeof text !== 'string' || !text) return '';
return text.charAt(0).toUpperCase() + text.slice(1);
}