UNPKG

mr-case

Version:

55 functions to seamlessly transform strings, arrays, and object keys between different cases (camelCase, snake_case, kebab-case, PascalCase, Title Case, and more), clean and format text, extract URL components, and perform common text operations like mas

8 lines (6 loc) 275 B
function isPalindrome(str) { if (typeof str !== 'string') throw new Error('Input must be a string'); const cleaned = str.replace(/[^a-zA-Z0-9]/g, '').toLowerCase(); return cleaned === cleaned.split('').reverse().join(''); } module.exports = isPalindrome;