mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-27 10:32:58 +02:00
12 lines
390 B
TypeScript
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;
|