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

10 lines (7 loc) 329 B
function isAnagram(str1, str2) { if (typeof str1 !== 'string' || typeof str2 !== 'string') throw new Error('Both inputs must be strings'); const clean = str => str.replace(/[^a-zA-Z]/g, '').toLowerCase().split('').sort().join(''); return clean(str1) === clean(str2); } module.exports = isAnagram;