cooking-temperature 1.0.5 → 1.0.7
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/README.md +56 -64
- package/dist/index.d.mts +12 -1
- package/dist/index.d.ts +12 -1
- package/dist/index.js +44 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +42 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/icons.d.mts +0 -16
- package/dist/icons.d.ts +0 -16
- package/dist/icons.js +0 -190
- package/dist/icons.js.map +0 -1
- package/dist/icons.mjs +0 -156
- package/dist/icons.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -3,15 +3,14 @@
|
|
|
3
3
|
A comprehensive library for safe cooking temperatures, doneness levels, and cooking instructions for various ingredients.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
|
-
|
|
7
6
|
```bash
|
|
8
7
|
npm install cooking-temperature
|
|
9
8
|
```
|
|
10
9
|
|
|
11
10
|
## Usage
|
|
12
|
-
|
|
13
11
|
```typescript
|
|
14
12
|
import {
|
|
13
|
+
search,
|
|
15
14
|
findByName,
|
|
16
15
|
findById,
|
|
17
16
|
findByCategory,
|
|
@@ -26,6 +25,14 @@ import {
|
|
|
26
25
|
convertTemperature,
|
|
27
26
|
} from "cooking-temperature"
|
|
28
27
|
|
|
28
|
+
// Search for ingredients
|
|
29
|
+
const results = search("chicken")
|
|
30
|
+
// Returns: CookingTemperatureEntry[] (all entries matching "chicken")
|
|
31
|
+
|
|
32
|
+
// Search with options
|
|
33
|
+
const limitedResults = search("pork", { category: "pork", limit: 3 })
|
|
34
|
+
// Returns: up to 3 pork entries matching "pork"
|
|
35
|
+
|
|
29
36
|
// Quick reference lookup
|
|
30
37
|
const chicken = getQuickReference("chicken breast", "oven_bake")
|
|
31
38
|
// Returns:
|
|
@@ -86,7 +93,6 @@ const celsius = convertTemperature(165, "F", "C")
|
|
|
86
93
|
## API
|
|
87
94
|
|
|
88
95
|
### Types
|
|
89
|
-
|
|
90
96
|
```typescript
|
|
91
97
|
type TemperatureUnit = "F" | "C"
|
|
92
98
|
|
|
@@ -105,12 +111,45 @@ type CookingMethod =
|
|
|
105
111
|
| "sous_vide" | "air_fry" | "deep_fry" | "slow_cook"
|
|
106
112
|
```
|
|
107
113
|
|
|
108
|
-
### Lookup Functions
|
|
114
|
+
### Search & Lookup Functions
|
|
109
115
|
|
|
110
|
-
#### `
|
|
116
|
+
#### `search(query: string, options?: { category?: IngredientCategory; limit?: number }): SearchResult[]`
|
|
111
117
|
|
|
112
|
-
|
|
118
|
+
Search for ingredients by name or alias. Returns flattened results with one entry per cooking method, sorted by relevance.
|
|
119
|
+
```typescript
|
|
120
|
+
type SearchResult = {
|
|
121
|
+
category: IngredientCategory
|
|
122
|
+
ingredientId: string
|
|
123
|
+
ingredientName: string
|
|
124
|
+
portionDescription: string
|
|
125
|
+
cookingMethod: string
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// Empty search - returns first 10 results (useful for initial display)
|
|
129
|
+
const defaultResults = search("")
|
|
130
|
+
// Returns: first 10 ingredient/method combinations
|
|
131
|
+
|
|
132
|
+
// Basic search - flattened by cooking method
|
|
133
|
+
const results = search("chicken")
|
|
134
|
+
// Returns: [
|
|
135
|
+
// { category: 'poultry', ingredientId: 'chicken_breast_boneless', ingredientName: 'Chicken Breast...', portionDescription: 'standard (6-8 oz...)', cookingMethod: 'oven_bake' },
|
|
136
|
+
// { category: 'poultry', ingredientId: 'chicken_breast_boneless', ingredientName: 'Chicken Breast...', portionDescription: 'standard (6-8 oz...)', cookingMethod: 'pan_sear' },
|
|
137
|
+
// ...
|
|
138
|
+
// ]
|
|
139
|
+
|
|
140
|
+
// Filter by category
|
|
141
|
+
const fishResults = search("fillet", { category: "seafood_fish" })
|
|
142
|
+
|
|
143
|
+
// Custom limit (default is 10)
|
|
144
|
+
const topResults = search("sal", { limit: 5 })
|
|
145
|
+
|
|
146
|
+
// Combine options
|
|
147
|
+
const porkChops = search("chop", { category: "pork", limit: 3 })
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
#### `findByName(query: string): CookingTemperatureEntry | undefined`
|
|
113
151
|
|
|
152
|
+
Find the first ingredient matching a name or alias (case-insensitive partial match).
|
|
114
153
|
```typescript
|
|
115
154
|
const entry = findByName("ribeye")
|
|
116
155
|
// Returns full CookingTemperatureEntry object or undefined
|
|
@@ -119,16 +158,14 @@ const entry = findByName("ribeye")
|
|
|
119
158
|
#### `findById(id: string): CookingTemperatureEntry | undefined`
|
|
120
159
|
|
|
121
160
|
Find an ingredient by its exact unique ID.
|
|
122
|
-
|
|
123
161
|
```typescript
|
|
124
|
-
const entry = findById("
|
|
162
|
+
const entry = findById("beef_steak_ribeye")
|
|
125
163
|
// Returns full CookingTemperatureEntry object or undefined
|
|
126
164
|
```
|
|
127
165
|
|
|
128
166
|
#### `findByCategory(category: IngredientCategory): CookingTemperatureEntry[]`
|
|
129
167
|
|
|
130
168
|
Get all ingredients in a category.
|
|
131
|
-
|
|
132
169
|
```typescript
|
|
133
170
|
const poultryItems = findByCategory("poultry")
|
|
134
171
|
// Returns: CookingTemperatureEntry[] (all poultry entries)
|
|
@@ -137,7 +174,6 @@ const poultryItems = findByCategory("poultry")
|
|
|
137
174
|
#### `getAllEntries(): CookingTemperatureEntry[]`
|
|
138
175
|
|
|
139
176
|
Get all cooking temperature entries in the library.
|
|
140
|
-
|
|
141
177
|
```typescript
|
|
142
178
|
const all = getAllEntries()
|
|
143
179
|
// Returns: CookingTemperatureEntry[] (all entries)
|
|
@@ -146,7 +182,6 @@ const all = getAllEntries()
|
|
|
146
182
|
#### `getAllCategories(): IngredientCategory[]`
|
|
147
183
|
|
|
148
184
|
Get all available categories.
|
|
149
|
-
|
|
150
185
|
```typescript
|
|
151
186
|
const categories = getAllCategories()
|
|
152
187
|
// Returns: ["poultry", "beef", "pork", "seafood_fish", "seafood_shellfish", "egg", "vegetable", "grain"]
|
|
@@ -155,7 +190,6 @@ const categories = getAllCategories()
|
|
|
155
190
|
#### `getCategoryName(category: IngredientCategory): string`
|
|
156
191
|
|
|
157
192
|
Get the human-readable display name for a category.
|
|
158
|
-
|
|
159
193
|
```typescript
|
|
160
194
|
const name = getCategoryName("seafood_fish")
|
|
161
195
|
// Returns: "Fish"
|
|
@@ -169,7 +203,6 @@ const name2 = getCategoryName("seafood_shellfish")
|
|
|
169
203
|
#### `convertTemperature(temp: number, from_unit: TemperatureUnit, to_unit: TemperatureUnit): number`
|
|
170
204
|
|
|
171
205
|
Convert between Fahrenheit and Celsius.
|
|
172
|
-
|
|
173
206
|
```typescript
|
|
174
207
|
const celsius = convertTemperature(165, "F", "C")
|
|
175
208
|
// Returns: 74
|
|
@@ -181,30 +214,28 @@ const fahrenheit = convertTemperature(74, "C", "F")
|
|
|
181
214
|
#### `getSafeMinimumTemp(ingredientId: string, unit?: TemperatureUnit): { temp: number; restMinutes: number } | undefined`
|
|
182
215
|
|
|
183
216
|
Get USDA safe minimum internal temperature for an ingredient.
|
|
184
|
-
|
|
185
217
|
```typescript
|
|
186
|
-
const safeTemp = getSafeMinimumTemp("
|
|
218
|
+
const safeTemp = getSafeMinimumTemp("chicken_breast_boneless", "F")
|
|
187
219
|
// Returns: { temp: 165, restMinutes: 0 }
|
|
188
220
|
|
|
189
|
-
const beefTemp = getSafeMinimumTemp("
|
|
221
|
+
const beefTemp = getSafeMinimumTemp("beef_steak_ribeye", "F")
|
|
190
222
|
// Returns: { temp: 145, restMinutes: 3 }
|
|
191
223
|
|
|
192
|
-
const inCelsius = getSafeMinimumTemp("
|
|
224
|
+
const inCelsius = getSafeMinimumTemp("chicken_breast_boneless", "C")
|
|
193
225
|
// Returns: { temp: 74, restMinutes: 0 }
|
|
194
226
|
```
|
|
195
227
|
|
|
196
228
|
#### `getDonenessTemp(ingredientId: string, doneness_level: DonenessLevel, unit?: TemperatureUnit): number | undefined`
|
|
197
229
|
|
|
198
230
|
Get internal temperature for a specific doneness level.
|
|
199
|
-
|
|
200
231
|
```typescript
|
|
201
|
-
const rare = getDonenessTemp("
|
|
232
|
+
const rare = getDonenessTemp("beef_steak_ribeye", "rare", "F")
|
|
202
233
|
// Returns: 125
|
|
203
234
|
|
|
204
|
-
const mediumRare = getDonenessTemp("
|
|
235
|
+
const mediumRare = getDonenessTemp("beef_steak_ribeye", "medium_rare", "F")
|
|
205
236
|
// Returns: 135
|
|
206
237
|
|
|
207
|
-
const medium = getDonenessTemp("
|
|
238
|
+
const medium = getDonenessTemp("beef_steak_ribeye", "medium", "C")
|
|
208
239
|
// Returns: 60
|
|
209
240
|
```
|
|
210
241
|
|
|
@@ -213,21 +244,19 @@ const medium = getDonenessTemp("beef-steak-ribeye", "medium", "C")
|
|
|
213
244
|
#### `getCookingMethods(ingredientId: string): CookingMethod[]`
|
|
214
245
|
|
|
215
246
|
Get available cooking methods for an ingredient.
|
|
216
|
-
|
|
217
247
|
```typescript
|
|
218
|
-
const methods = getCookingMethods("
|
|
248
|
+
const methods = getCookingMethods("salmon_fillet")
|
|
219
249
|
// Returns: ["oven_bake", "pan_sear", "grill", "poach", "sous_vide"]
|
|
220
250
|
|
|
221
|
-
const chickenMethods = getCookingMethods("
|
|
251
|
+
const chickenMethods = getCookingMethods("chicken_breast_boneless")
|
|
222
252
|
// Returns: ["oven_bake", "pan_sear", "grill", "poach", "sous_vide", "air_fry"]
|
|
223
253
|
```
|
|
224
254
|
|
|
225
255
|
#### `getCookingInstruction(ingredientId: string, cooking_method: CookingMethod, portionHint?: string): object | undefined`
|
|
226
256
|
|
|
227
257
|
Get detailed cooking instructions for a specific method.
|
|
228
|
-
|
|
229
258
|
```typescript
|
|
230
|
-
const instructions = getCookingInstruction("
|
|
259
|
+
const instructions = getCookingInstruction("salmon_fillet", "oven_bake")
|
|
231
260
|
// Returns:
|
|
232
261
|
// {
|
|
233
262
|
// applianceTemp: 400,
|
|
@@ -238,14 +267,13 @@ const instructions = getCookingInstruction("salmon-fillet", "oven_bake")
|
|
|
238
267
|
// }
|
|
239
268
|
|
|
240
269
|
// With portion hint for specific cuts
|
|
241
|
-
const thickCut = getCookingInstruction("
|
|
270
|
+
const thickCut = getCookingInstruction("beef_steak_ribeye", "grill", "1.5 inch")
|
|
242
271
|
// Returns instructions for 1.5 inch thick steak
|
|
243
272
|
```
|
|
244
273
|
|
|
245
274
|
#### `getQuickReference(query: string, cooking_method?: CookingMethod, unit?: TemperatureUnit): object | undefined`
|
|
246
275
|
|
|
247
276
|
Get a quick reference with all relevant cooking info combined.
|
|
248
|
-
|
|
249
277
|
```typescript
|
|
250
278
|
const ref = getQuickReference("chicken breast", "oven_bake", "F")
|
|
251
279
|
// Returns:
|
|
@@ -323,42 +351,6 @@ For proteins that support doneness preferences:
|
|
|
323
351
|
| `deep_fry` | Submerged in hot oil |
|
|
324
352
|
| `slow_cook` | Low temperature, long duration |
|
|
325
353
|
|
|
326
|
-
## Icons
|
|
327
|
-
|
|
328
|
-
The library includes SVG icons as base64-encoded data URLs for categories and common ingredients.
|
|
329
|
-
|
|
330
|
-
```typescript
|
|
331
|
-
import {
|
|
332
|
-
CATEGORY_ICONS,
|
|
333
|
-
INGREDIENT_ICONS,
|
|
334
|
-
getIcon,
|
|
335
|
-
} from "cooking-temperature/icons"
|
|
336
|
-
|
|
337
|
-
// Get a category icon
|
|
338
|
-
const poultryIcon = CATEGORY_ICONS["poultry"]
|
|
339
|
-
// Returns: "data:image/svg+xml;base64,..."
|
|
340
|
-
|
|
341
|
-
// Get a specific ingredient icon
|
|
342
|
-
const salmonIcon = INGREDIENT_ICONS["salmon_fillet"]
|
|
343
|
-
|
|
344
|
-
// Use the helper function (falls back to category icon if no specific icon exists)
|
|
345
|
-
const icon = getIcon("salmon_fillet", "seafood_fish")
|
|
346
|
-
```
|
|
347
|
-
|
|
348
|
-
### Available Icon Exports
|
|
349
|
-
|
|
350
|
-
| Export | Description |
|
|
351
|
-
|--------|-------------|
|
|
352
|
-
| `CATEGORY_ICONS` | Icons for each food category (poultry, beef, pork, seafood_fish, seafood_shellfish, egg, vegetable, grain) |
|
|
353
|
-
| `POULTRY_ICONS` | Chicken breast, thigh, whole chicken, turkey breast |
|
|
354
|
-
| `BEEF_ICONS` | Ribeye steak, ground beef, beef roast |
|
|
355
|
-
| `SEAFOOD_ICONS` | Salmon fillet, shrimp, cod fillet, tuna steak |
|
|
356
|
-
| `EGG_ICONS` | Fried, boiled, scrambled, poached eggs |
|
|
357
|
-
| `VEGETABLE_ICONS` | Broccoli, asparagus, potato, carrot |
|
|
358
|
-
| `GRAIN_ICONS` | White rice, pasta, quinoa |
|
|
359
|
-
| `INGREDIENT_ICONS` | Combined export of all ingredient icons |
|
|
360
|
-
| `getIcon(id, category?)` | Helper function that returns an icon by ID, with optional category fallback |
|
|
361
|
-
|
|
362
354
|
## License
|
|
363
355
|
|
|
364
356
|
MIT
|
package/dist/index.d.mts
CHANGED
|
@@ -74,5 +74,16 @@ declare const getQuickReference: (query: string, cooking_method?: CookingMethod,
|
|
|
74
74
|
};
|
|
75
75
|
visualIndicators: string[];
|
|
76
76
|
} | undefined;
|
|
77
|
+
type SearchResult = {
|
|
78
|
+
category: IngredientCategory;
|
|
79
|
+
ingredientId: string;
|
|
80
|
+
ingredientName: string;
|
|
81
|
+
portionDescription: string;
|
|
82
|
+
cookingMethod: string;
|
|
83
|
+
};
|
|
84
|
+
declare const search: (query: string, options?: {
|
|
85
|
+
category?: IngredientCategory;
|
|
86
|
+
limit?: number;
|
|
87
|
+
}) => SearchResult[];
|
|
77
88
|
|
|
78
|
-
export { type CookingInstruction, type CookingMethod, type CookingTemperatureEntry, type DonenessLevel, type DonenessSpec, type IngredientCategory, type TemperatureUnit, convertTemperature, findByCategory, findById, findByName, getAllCategories, getAllEntries, getCategoryName, getCookingInstruction, getCookingMethods, getDonenessTemp, getQuickReference, getSafeMinimumTemp };
|
|
89
|
+
export { type CookingInstruction, type CookingMethod, type CookingTemperatureEntry, type DonenessLevel, type DonenessSpec, type IngredientCategory, type SearchResult, type TemperatureUnit, convertTemperature, findByCategory, findById, findByName, getAllCategories, getAllEntries, getCategoryName, getCookingInstruction, getCookingMethods, getDonenessTemp, getQuickReference, getSafeMinimumTemp, search };
|
package/dist/index.d.ts
CHANGED
|
@@ -74,5 +74,16 @@ declare const getQuickReference: (query: string, cooking_method?: CookingMethod,
|
|
|
74
74
|
};
|
|
75
75
|
visualIndicators: string[];
|
|
76
76
|
} | undefined;
|
|
77
|
+
type SearchResult = {
|
|
78
|
+
category: IngredientCategory;
|
|
79
|
+
ingredientId: string;
|
|
80
|
+
ingredientName: string;
|
|
81
|
+
portionDescription: string;
|
|
82
|
+
cookingMethod: string;
|
|
83
|
+
};
|
|
84
|
+
declare const search: (query: string, options?: {
|
|
85
|
+
category?: IngredientCategory;
|
|
86
|
+
limit?: number;
|
|
87
|
+
}) => SearchResult[];
|
|
77
88
|
|
|
78
|
-
export { type CookingInstruction, type CookingMethod, type CookingTemperatureEntry, type DonenessLevel, type DonenessSpec, type IngredientCategory, type TemperatureUnit, convertTemperature, findByCategory, findById, findByName, getAllCategories, getAllEntries, getCategoryName, getCookingInstruction, getCookingMethods, getDonenessTemp, getQuickReference, getSafeMinimumTemp };
|
|
89
|
+
export { type CookingInstruction, type CookingMethod, type CookingTemperatureEntry, type DonenessLevel, type DonenessSpec, type IngredientCategory, type SearchResult, type TemperatureUnit, convertTemperature, findByCategory, findById, findByName, getAllCategories, getAllEntries, getCategoryName, getCookingInstruction, getCookingMethods, getDonenessTemp, getQuickReference, getSafeMinimumTemp, search };
|
package/dist/index.js
CHANGED
|
@@ -31,7 +31,8 @@ __export(index_exports, {
|
|
|
31
31
|
getCookingMethods: () => getCookingMethods,
|
|
32
32
|
getDonenessTemp: () => getDonenessTemp,
|
|
33
33
|
getQuickReference: () => getQuickReference,
|
|
34
|
-
getSafeMinimumTemp: () => getSafeMinimumTemp
|
|
34
|
+
getSafeMinimumTemp: () => getSafeMinimumTemp,
|
|
35
|
+
search: () => search
|
|
35
36
|
});
|
|
36
37
|
module.exports = __toCommonJS(index_exports);
|
|
37
38
|
|
|
@@ -1955,6 +1956,46 @@ var getQuickReference = (query, cooking_method, unit = "F") => {
|
|
|
1955
1956
|
visualIndicators: entry.visualIndicators ?? []
|
|
1956
1957
|
};
|
|
1957
1958
|
};
|
|
1959
|
+
var search = (query, options) => {
|
|
1960
|
+
const normalizedQuery = query.toLowerCase().trim();
|
|
1961
|
+
const limit = options?.limit ?? 10;
|
|
1962
|
+
let matchingEntries = ALL_ENTRIES;
|
|
1963
|
+
if (normalizedQuery) {
|
|
1964
|
+
matchingEntries = matchingEntries.filter(
|
|
1965
|
+
(entry) => entry.name.toLowerCase().includes(normalizedQuery) || entry.aliases.some(
|
|
1966
|
+
(alias) => alias.toLowerCase().includes(normalizedQuery)
|
|
1967
|
+
)
|
|
1968
|
+
);
|
|
1969
|
+
}
|
|
1970
|
+
if (options?.category) {
|
|
1971
|
+
matchingEntries = matchingEntries.filter(
|
|
1972
|
+
(entry) => entry.category === options.category
|
|
1973
|
+
);
|
|
1974
|
+
}
|
|
1975
|
+
const results = matchingEntries.flatMap(
|
|
1976
|
+
(entry) => entry.cookingInstructions.flatMap(
|
|
1977
|
+
(instruction) => instruction.methods.map((method) => ({
|
|
1978
|
+
category: entry.category,
|
|
1979
|
+
ingredientId: entry.id,
|
|
1980
|
+
ingredientName: entry.name,
|
|
1981
|
+
portionDescription: instruction.portionDescription,
|
|
1982
|
+
cookingMethod: method.method
|
|
1983
|
+
}))
|
|
1984
|
+
)
|
|
1985
|
+
);
|
|
1986
|
+
if (normalizedQuery) {
|
|
1987
|
+
results.sort((a, b) => {
|
|
1988
|
+
const aName = a.ingredientName.toLowerCase();
|
|
1989
|
+
const bName = b.ingredientName.toLowerCase();
|
|
1990
|
+
if (aName === normalizedQuery && bName !== normalizedQuery) return -1;
|
|
1991
|
+
if (bName === normalizedQuery && aName !== normalizedQuery) return 1;
|
|
1992
|
+
if (aName.startsWith(normalizedQuery) && !bName.startsWith(normalizedQuery)) return -1;
|
|
1993
|
+
if (bName.startsWith(normalizedQuery) && !aName.startsWith(normalizedQuery)) return 1;
|
|
1994
|
+
return aName.localeCompare(bName);
|
|
1995
|
+
});
|
|
1996
|
+
}
|
|
1997
|
+
return results.slice(0, limit);
|
|
1998
|
+
};
|
|
1958
1999
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1959
2000
|
0 && (module.exports = {
|
|
1960
2001
|
convertTemperature,
|
|
@@ -1968,6 +2009,7 @@ var getQuickReference = (query, cooking_method, unit = "F") => {
|
|
|
1968
2009
|
getCookingMethods,
|
|
1969
2010
|
getDonenessTemp,
|
|
1970
2011
|
getQuickReference,
|
|
1971
|
-
getSafeMinimumTemp
|
|
2012
|
+
getSafeMinimumTemp,
|
|
2013
|
+
search
|
|
1972
2014
|
});
|
|
1973
2015
|
//# sourceMappingURL=index.js.map
|