everyutil
Version:
A comprehensive library of lightweight, reusable utility functions for JavaScript and TypeScript, designed to streamline common programming tasks such as string manipulation, array processing, date handling, and more.
16 lines (15 loc) • 457 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.findAnagrams = void 0;
/**
* Checks if two strings are anagrams.
* @author @dailker
* @param {string} a
* @param {string} b
* @returns {boolean}
*/
function findAnagrams(a, b) {
const normalize = (s) => s.replace(/\s+/g, '').toLowerCase().split('').sort().join('');
return normalize(a) === normalize(b);
}
exports.findAnagrams = findAnagrams;