1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-18 09:35:20 +02:00
joplin/packages/tools/licenses/utils/equalIgnoringSpacing.ts
Henry Heino 02bdb7a79c
Docs: Include dependency overview (#10911)
Co-authored-by: Laurent Cozic <laurent22@users.noreply.github.com>
2024-08-22 21:53:27 +01:00

12 lines
390 B
TypeScript

// Some sources present licenses with different spacing.
// This function can be used to compare ignoring spaces.
const wordsMatch = (text1: string, text2: string) => {
const excludeRegex = /[ \t\n"]+/g;
text1 = text1.replace(excludeRegex, ' ').trim().toLowerCase();
text2 = text2.replace(excludeRegex, ' ').trim().toLowerCase();
return text1 === text2;
};
export default wordsMatch;