mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-21 09:38:01 +02:00
02bdb7a79c
Co-authored-by: Laurent Cozic <laurent22@users.noreply.github.com>
27 lines
651 B
TypeScript
27 lines
651 B
TypeScript
import apache2 from '../licenseText/apache2';
|
|
import wordsMatch from './equalIgnoringSpacing';
|
|
|
|
const matchApache2 = (text: string) => {
|
|
const termsEndString = 'END OF TERMS AND CONDITIONS';
|
|
const termsEndStringIndex = text.indexOf(termsEndString);
|
|
|
|
if (termsEndStringIndex === -1) {
|
|
return null;
|
|
}
|
|
|
|
const termsEndIndex = termsEndStringIndex + termsEndString.length;
|
|
const textWithoutAppendices = text.substring(0, termsEndIndex);
|
|
|
|
if (!wordsMatch(apache2, textWithoutAppendices)) {
|
|
return null;
|
|
}
|
|
|
|
const textAppendix = text.substring(termsEndIndex, text.length);
|
|
|
|
return {
|
|
appendix: textAppendix,
|
|
};
|
|
};
|
|
|
|
export default matchApache2;
|