@jclind/ingredient-parser 1.0.31 → 1.0.33

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.
@@ -27,8 +27,16 @@ export const parseIngredientString = (ingrStr) => {
27
27
  ingrText = convertFractions(ingrStr.replace(parenRegex, '').trim());
28
28
  comment = parenthesesStr.trim();
29
29
  }
30
- console.log(ingrText, comment, parenthesesStr);
31
- const parsedIngrRes = parse(ingrText, 'eng');
30
+ const prepIngrText = ingrText.replace(/\b(lb|lbs)\b/g, match => {
31
+ // Replace lb or lbs with pound or pounds respectively
32
+ if (match === 'lb') {
33
+ return 'pound';
34
+ }
35
+ else {
36
+ return 'pounds';
37
+ }
38
+ });
39
+ const parsedIngrRes = parse(prepIngrText, 'eng');
32
40
  if (!parsedIngrRes.ingredient) {
33
41
  return { ...parsedIngrRes, originalIngredientString: ingrStr, comment };
34
42
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jclind/ingredient-parser",
3
- "version": "1.0.31",
3
+ "version": "1.0.33",
4
4
  "description": "Parses given sentence including ingredient information and attemps to return quantity, measurement and ingredient data",
5
5
  "keywords": [
6
6
  "recipe",
@@ -9,11 +9,12 @@
9
9
  "units"
10
10
  ],
11
11
  "main": "dist/index.js",
12
- "types": "./index.d.ts",
13
- "typings": "./index.d.ts",
12
+ "types": "./types.d.ts",
13
+ "typings": "./types.d.ts",
14
14
  "type": "module",
15
15
  "files": [
16
- "dist"
16
+ "dist",
17
+ "types.js"
17
18
  ],
18
19
  "scripts": {
19
20
  "build": "tsc"