is-vegan
Version:
Is-Vegan is a library which helps you to find out which ingridiends are not vegan
47 lines (43 loc) • 1.99 kB
text/typescript
/**
* This functions takes the given ingredient
* and checks it against the non-vegan list of ingredients
* @param ingredientToCheck - the ingredient to check
* @return if ingredient is in nonVeganList or if all ingredient words are in nonVeganList. Otherwise true
*/
declare function isVeganIngredient(ingredientToCheck: string): boolean;
/**
* This functions takes a given list of ingredients
* and checks them against the non-vegan list of ingredients
* @param ingredientsToCheck - the lit of ingredients to check
* @return if ingredients are not in nonVeganList
*/
declare function isVeganIngredientList(ingredientsToCheck: string[]): boolean;
/**
* This functions takes a given list of ingredients
* and checks them against the non-vegan list of ingredients
* @param ingredientsToCheck - the lit of ingredients to check
* @return Array of ingredients that are non-vegan
*/
declare function containsNonVeganIngredients(ingredientsToCheck: string[]): string[];
/**
* This functions takes a given list of ingredients
* and checks them against the non-vegan and the can-be-vegan list of ingredients
* @param ingredientsToCheck - the list of ingredients to check
* @return with nonvegan and flagged ingredients
*/
declare function checkIngredients(ingredientsToCheck: string[]): {
nonvegan: string[];
flagged: string[];
};
/**
* This functions returns the currently selected ingredients language
* @return The two-letter code (ISO 639-1) of the currently selected ingredients language
*/
declare function getIngredientsLanguage(): string;
/**
* This functions sets the ingredients language
* @param value - The two-letter code (ISO 639-1) of the ingredients language to set
* @throws Will throw an error if validation fails
*/
declare function setIngredientsLanguage(value: string | null | undefined): void;
export { checkIngredients, containsNonVeganIngredients, getIngredientsLanguage, isVeganIngredient, isVeganIngredientList, setIngredientsLanguage };