UNPKG

stringzy

Version:

A versatile string manipulation library providing a range of text utilities for JavaScript and Node.js applications.

17 lines (16 loc) 538 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.deburr = deburr; /** * Removes accents and diacritics from letters in a string. * @param str - Input string * @returns A deburred string without accented characters. * @throws Error if input is not a string */ function deburr(str) { if (typeof str !== 'string') { throw new Error('Input must be a string'); } // Normalize and strip combining marks (diacritics) return str.normalize('NFD').replace(/[\u0300-\u036f]/g, ''); }