@jclind/ingredient-parser 1.2.7 → 1.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -20,21 +20,17 @@ const removeConsecutiveTs = (str) => {
|
|
|
20
20
|
const replaceModifiedWords = (words, str) => {
|
|
21
21
|
let updatedStr = str;
|
|
22
22
|
words.forEach(({ original, modified }) => {
|
|
23
|
-
updatedStr = updatedStr.replace(modified, original);
|
|
23
|
+
updatedStr = updatedStr.replace(modified.toLowerCase(), original.toLowerCase());
|
|
24
24
|
});
|
|
25
25
|
return updatedStr;
|
|
26
26
|
};
|
|
27
27
|
const parseStringConsecutiveTs = (ingrStr) => {
|
|
28
28
|
var _a;
|
|
29
|
-
// const ingrStrToLower = ingrStr.toLowerCase()
|
|
30
29
|
const removeTTsIngrName = ingrStr.replace(/t{2,}/g, '');
|
|
31
30
|
const modifiedWords = removeConsecutiveTs(ingrStr);
|
|
32
|
-
console.log(modifiedWords);
|
|
33
31
|
if (modifiedWords.length > 0) {
|
|
34
32
|
const parsedIngrNoTs = (0, recipe_ingredient_parser_v3_1.parse)(removeTTsIngrName, 'eng');
|
|
35
|
-
console.log(parsedIngrNoTs);
|
|
36
33
|
const correctIngrStr = replaceModifiedWords(modifiedWords, (_a = parsedIngrNoTs.ingredient) !== null && _a !== void 0 ? _a : '');
|
|
37
|
-
console.log(correctIngrStr);
|
|
38
34
|
const parsedIngr = Object.assign(Object.assign({}, parsedIngrNoTs), { ingredient: correctIngrStr });
|
|
39
35
|
return parsedIngr;
|
|
40
36
|
}
|
package/package.json
CHANGED