@jclind/ingredient-parser 1.0.41 → 1.0.42

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.
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import ingredientParser from './funcs/ingredientParser';
2
- export * from '@jclind/ingredient-parser';
1
+ import ingredientParser from './src/funcs/ingredientParser';
3
2
  export { ingredientParser };
3
+ export * from './types';
package/dist/index.js CHANGED
@@ -15,6 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.ingredientParser = void 0;
18
- const ingredientParser_1 = require("./funcs/ingredientParser");
18
+ const ingredientParser_1 = require("./src/funcs/ingredientParser");
19
19
  exports.ingredientParser = ingredientParser_1.default;
20
- __exportStar(require("@jclind/ingredient-parser"), exports);
20
+ __exportStar(require("./types"), exports);
@@ -1,4 +1,4 @@
1
- import { IngredientData } from '@jclind/ingredient-parser';
1
+ import { IngredientData } from '../../types.js';
2
2
  export declare const checkIngredient: (name: string) => Promise<import("axios").AxiosResponse<any, any>>;
3
3
  export declare const searchIngredient: (name: string, spoonacularAPIKey: string) => Promise<any>;
4
4
  export declare const getIngredientInformation: (ingrId: number, unit: boolean, spoonacularAPIKey: string) => Promise<any>;
@@ -1,3 +1,3 @@
1
- import { IngredientResponse } from '@jclind/ingredient-parser';
1
+ import { IngredientResponse } from '../../types.js';
2
2
  declare const ingredientParser: (ingrString: string, spoonacularAPIKey: string) => Promise<IngredientResponse>;
3
3
  export default ingredientParser;
@@ -1,2 +1,2 @@
1
- import { ParsedIngredient } from '@jclind/ingredient-parser';
1
+ import { ParsedIngredient } from '../../types.js';
2
2
  export declare const parseIngredientString: (ingrStr: string) => ParsedIngredient;
@@ -0,0 +1,73 @@
1
+ type StringOrNull = string | null;
2
+ type NumberOrNull = number | null;
3
+ export type IngredientResponse = {
4
+ parsedIngredient: ParsedIngredient;
5
+ ingredientData: IngredientData;
6
+ id?: string;
7
+ } | {
8
+ error: {
9
+ message: string;
10
+ };
11
+ parsedIngredient: ParsedIngredient;
12
+ ingredientData: IngredientData | null;
13
+ id?: string;
14
+ };
15
+ export type ParsedIngredient = {
16
+ quantity: NumberOrNull;
17
+ unit: StringOrNull;
18
+ unitPlural: StringOrNull;
19
+ symbol: StringOrNull;
20
+ ingredient: StringOrNull;
21
+ originalIngredientString: string;
22
+ minQty: NumberOrNull;
23
+ maxQty: NumberOrNull;
24
+ comment: StringOrNull;
25
+ };
26
+ export interface IngredientData {
27
+ _id: string;
28
+ ingredientId: number;
29
+ originalName: string;
30
+ name: string;
31
+ amount: number;
32
+ possibleUnits: string[];
33
+ consistency: string;
34
+ shoppingListUnits: string[];
35
+ aisle: string;
36
+ image: string;
37
+ imagePath: string;
38
+ nutrition: Nutrition;
39
+ totalPriceUSACents: number;
40
+ }
41
+ export interface Nutrition {
42
+ nutrients: Nutrient[];
43
+ properties: Property[];
44
+ flavonoids: Flavonoid[];
45
+ caloricBreakdown: CaloricBreakdown;
46
+ weightPerServing: WeightPerServing;
47
+ }
48
+ export interface Nutrient {
49
+ name: string;
50
+ amount: number;
51
+ unit: string;
52
+ percentOfDailyNeeds: number;
53
+ }
54
+ export interface Property {
55
+ name: string;
56
+ amount: number;
57
+ unit: string;
58
+ }
59
+ export interface Flavonoid {
60
+ name: string;
61
+ amount: number;
62
+ unit: string;
63
+ }
64
+ export interface CaloricBreakdown {
65
+ percentProtein: number;
66
+ percentFat: number;
67
+ percentCarbs: number;
68
+ }
69
+ export interface WeightPerServing {
70
+ amount: number;
71
+ unit: string;
72
+ }
73
+ export {};
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jclind/ingredient-parser",
3
- "version": "1.0.41",
3
+ "version": "1.0.42",
4
4
  "description": "Parses given sentence including ingredient information and attempts to return quantity, measurement and ingredient data",
5
5
  "keywords": [
6
6
  "recipe",
@@ -9,6 +9,7 @@
9
9
  "units"
10
10
  ],
11
11
  "main": "dist/index.js",
12
+ "types": "dist/index.d.ts",
12
13
  "files": [
13
14
  "dist"
14
15
  ],
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes