@jclind/ingredient-parser 1.1.1 → 1.2.0

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.
Files changed (2) hide show
  1. package/README.md +4 -2
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -14,7 +14,8 @@ import { parseIngredient } from '@jclind/ingredient-parser';
14
14
 
15
15
  const ingredientString = '1 cup rice, washed';
16
16
  const apiKey = 'YOUR_API_KEY';
17
- parseIngredient(ingredientString, apiKey);
17
+ const options = { returnNutritionData: true };
18
+ parseIngredient(ingredientString, apiKey, options);
18
19
  ```
19
20
  Returns an object `{id: (randomly generated id unique to every request), parsedIngredient, ingredientData}` with the following properties/values.
20
21
 
@@ -47,7 +48,7 @@ Returns an object `{id: (randomly generated id unique to every request), parsedI
47
48
  aisle: 'Pasta and Rice',
48
49
  image: 'uncooked-white-rice.png',
49
50
  imagePath: 'https://spoonacular.com/cdn/ingredients_100x100/uncooked-white-rice.png',
50
- nutrition: {
51
+ nutrition?: {
51
52
  nutrients: [Array],
52
53
  properties: [Array],
53
54
  flavonoids: [Array],
@@ -65,6 +66,7 @@ Returns an object `{id: (randomly generated id unique to every request), parsedI
65
66
 
66
67
  - `ingredientString` (string) [required] : preferably formatted as such: (quantity) (unit) (ingredient), (comment separated by a comment) i.e. 2 cups onions, diced
67
68
  - `SPOONACULAR_API_KEY` (string) [required] : your unique [spoonacular](https://spoonacular.com/food-api) API key.
69
+ - `options` (object) [optional] : an object containing additional options. Currently, the only supported option is `returnNutritionData`, which, if set to `true`, will include nutrition data in the ingredientData object.
68
70
 
69
71
  Note: You need to sign up for a free API key from [spoonacular website](https://spoonacular.com/food-api).
70
72
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jclind/ingredient-parser",
3
- "version": "1.1.1",
3
+ "version": "1.2.0",
4
4
  "description": "Parses given sentence including ingredient information and attempts to return quantity, measurement and ingredient data",
5
5
  "keywords": [
6
6
  "recipe",