This commit is contained in:
@@ -40,7 +40,7 @@ const SENKSERIKOVA_URL = 'https://www.menicka.cz/6561-pivovarsky-senk-serikova.h
|
||||
* @param text vstupní text
|
||||
* @returns true, pokud text představuje polévku
|
||||
*/
|
||||
const isTextSoupName = (text: string): boolean => {
|
||||
export const isTextSoupName = (text: string): boolean => {
|
||||
for (const name of SOUP_NAMES) {
|
||||
if (text.toLowerCase().includes(name)) {
|
||||
return true;
|
||||
@@ -49,11 +49,11 @@ const isTextSoupName = (text: string): boolean => {
|
||||
return false;
|
||||
}
|
||||
|
||||
const capitalize = (word: string): string => {
|
||||
export const capitalize = (word: string): string => {
|
||||
return word.charAt(0).toUpperCase() + word.slice(1);
|
||||
}
|
||||
|
||||
const sanitizeText = (text: string): string => {
|
||||
export const sanitizeText = (text: string): string => {
|
||||
return text.replace('\t', '').replace(' , ', ', ').trim();
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ const sanitizeText = (text: string): string => {
|
||||
* @param name původní název jídla
|
||||
* @returns objekt obsahující vyčištěný název a pole alergenů
|
||||
*/
|
||||
const parseAllergens = (name: string): { cleanName: string, allergens: number[] } => {
|
||||
export const parseAllergens = (name: string): { cleanName: string, allergens: number[] } => {
|
||||
// Regex pro nalezení čísel na konci řetězce oddělených čárkami a případnými mezerami
|
||||
const regex = /\s+(\d+(?:\s*,\s*\d+)*)\s*$/;
|
||||
const match = regex.exec(name);
|
||||
|
||||
Reference in New Issue
Block a user