@jclind/ingredient-parser 1.1.0 → 1.1.1
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.
|
@@ -32,14 +32,19 @@ const parseIngredientString = (ingrStr) => {
|
|
|
32
32
|
ingrText = (0, convertFractions_js_1.convertFractions)(ingrStr.replace(parenRegex, '').trim());
|
|
33
33
|
comment = parenthesesStr.trim();
|
|
34
34
|
}
|
|
35
|
-
const prepIngrText = ingrText.replace(/\b(lb|lbs)\b/
|
|
36
|
-
// Replace lb or lbs with pound or pounds respectively
|
|
35
|
+
const prepIngrText = ingrText.replace(/\b(lb|lbs|tablespoon|tablespoon)\b/gi, match => {
|
|
37
36
|
if (match === 'lb') {
|
|
38
37
|
return 'pound';
|
|
39
38
|
}
|
|
40
|
-
else {
|
|
39
|
+
else if (match === 'lbs') {
|
|
41
40
|
return 'pounds';
|
|
42
41
|
}
|
|
42
|
+
else if (match === 'tablespoon') {
|
|
43
|
+
return 'tbsp';
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
return 'tbsps';
|
|
47
|
+
}
|
|
43
48
|
});
|
|
44
49
|
const parsedIngrRes = (0, parseStringConsecutiveTs_js_1.parseStringConsecutiveTs)(prepIngrText);
|
|
45
50
|
console.log(parsedIngrRes);
|
package/package.json
CHANGED