cooking-temperature 1.0.4 → 1.0.6
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 +43 -64
- package/dist/index.d.mts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +37 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +35 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/icons.d.mts +0 -5
- package/dist/icons.d.ts +0 -5
- package/dist/icons.js +0 -102
- package/dist/icons.js.map +0 -1
- package/dist/icons.mjs +0 -75
- 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,32 @@ 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 }): CookingTemperatureEntry[]`
|
|
117
|
+
|
|
118
|
+
Search for ingredients by name or alias. Returns results sorted by relevance (exact matches first, then name matches, then alias matches).
|
|
119
|
+
```typescript
|
|
120
|
+
// Basic search - returns all matches
|
|
121
|
+
const results = search("chicken")
|
|
122
|
+
// Returns: [Chicken Breast, Chicken Thigh, ...]
|
|
123
|
+
|
|
124
|
+
// Filter by category
|
|
125
|
+
const fishResults = search("fillet", { category: "seafood_fish" })
|
|
126
|
+
// Returns: [Salmon Fillet, Cod Fillet]
|
|
127
|
+
|
|
128
|
+
// Limit results (useful for autocomplete)
|
|
129
|
+
const topResults = search("sal", { limit: 5 })
|
|
130
|
+
// Returns: up to 5 matching entries
|
|
111
131
|
|
|
112
|
-
|
|
132
|
+
// Combine options
|
|
133
|
+
const porkChops = search("chop", { category: "pork", limit: 3 })
|
|
134
|
+
// Returns: up to 3 pork entries matching "chop"
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
#### `findByName(query: string): CookingTemperatureEntry | undefined`
|
|
113
138
|
|
|
139
|
+
Find the first ingredient matching a name or alias (case-insensitive partial match).
|
|
114
140
|
```typescript
|
|
115
141
|
const entry = findByName("ribeye")
|
|
116
142
|
// Returns full CookingTemperatureEntry object or undefined
|
|
@@ -119,16 +145,14 @@ const entry = findByName("ribeye")
|
|
|
119
145
|
#### `findById(id: string): CookingTemperatureEntry | undefined`
|
|
120
146
|
|
|
121
147
|
Find an ingredient by its exact unique ID.
|
|
122
|
-
|
|
123
148
|
```typescript
|
|
124
|
-
const entry = findById("
|
|
149
|
+
const entry = findById("beef_steak_ribeye")
|
|
125
150
|
// Returns full CookingTemperatureEntry object or undefined
|
|
126
151
|
```
|
|
127
152
|
|
|
128
153
|
#### `findByCategory(category: IngredientCategory): CookingTemperatureEntry[]`
|
|
129
154
|
|
|
130
155
|
Get all ingredients in a category.
|
|
131
|
-
|
|
132
156
|
```typescript
|
|
133
157
|
const poultryItems = findByCategory("poultry")
|
|
134
158
|
// Returns: CookingTemperatureEntry[] (all poultry entries)
|
|
@@ -137,7 +161,6 @@ const poultryItems = findByCategory("poultry")
|
|
|
137
161
|
#### `getAllEntries(): CookingTemperatureEntry[]`
|
|
138
162
|
|
|
139
163
|
Get all cooking temperature entries in the library.
|
|
140
|
-
|
|
141
164
|
```typescript
|
|
142
165
|
const all = getAllEntries()
|
|
143
166
|
// Returns: CookingTemperatureEntry[] (all entries)
|
|
@@ -146,7 +169,6 @@ const all = getAllEntries()
|
|
|
146
169
|
#### `getAllCategories(): IngredientCategory[]`
|
|
147
170
|
|
|
148
171
|
Get all available categories.
|
|
149
|
-
|
|
150
172
|
```typescript
|
|
151
173
|
const categories = getAllCategories()
|
|
152
174
|
// Returns: ["poultry", "beef", "pork", "seafood_fish", "seafood_shellfish", "egg", "vegetable", "grain"]
|
|
@@ -155,7 +177,6 @@ const categories = getAllCategories()
|
|
|
155
177
|
#### `getCategoryName(category: IngredientCategory): string`
|
|
156
178
|
|
|
157
179
|
Get the human-readable display name for a category.
|
|
158
|
-
|
|
159
180
|
```typescript
|
|
160
181
|
const name = getCategoryName("seafood_fish")
|
|
161
182
|
// Returns: "Fish"
|
|
@@ -169,7 +190,6 @@ const name2 = getCategoryName("seafood_shellfish")
|
|
|
169
190
|
#### `convertTemperature(temp: number, from_unit: TemperatureUnit, to_unit: TemperatureUnit): number`
|
|
170
191
|
|
|
171
192
|
Convert between Fahrenheit and Celsius.
|
|
172
|
-
|
|
173
193
|
```typescript
|
|
174
194
|
const celsius = convertTemperature(165, "F", "C")
|
|
175
195
|
// Returns: 74
|
|
@@ -181,30 +201,28 @@ const fahrenheit = convertTemperature(74, "C", "F")
|
|
|
181
201
|
#### `getSafeMinimumTemp(ingredientId: string, unit?: TemperatureUnit): { temp: number; restMinutes: number } | undefined`
|
|
182
202
|
|
|
183
203
|
Get USDA safe minimum internal temperature for an ingredient.
|
|
184
|
-
|
|
185
204
|
```typescript
|
|
186
|
-
const safeTemp = getSafeMinimumTemp("
|
|
205
|
+
const safeTemp = getSafeMinimumTemp("chicken_breast_boneless", "F")
|
|
187
206
|
// Returns: { temp: 165, restMinutes: 0 }
|
|
188
207
|
|
|
189
|
-
const beefTemp = getSafeMinimumTemp("
|
|
208
|
+
const beefTemp = getSafeMinimumTemp("beef_steak_ribeye", "F")
|
|
190
209
|
// Returns: { temp: 145, restMinutes: 3 }
|
|
191
210
|
|
|
192
|
-
const inCelsius = getSafeMinimumTemp("
|
|
211
|
+
const inCelsius = getSafeMinimumTemp("chicken_breast_boneless", "C")
|
|
193
212
|
// Returns: { temp: 74, restMinutes: 0 }
|
|
194
213
|
```
|
|
195
214
|
|
|
196
215
|
#### `getDonenessTemp(ingredientId: string, doneness_level: DonenessLevel, unit?: TemperatureUnit): number | undefined`
|
|
197
216
|
|
|
198
217
|
Get internal temperature for a specific doneness level.
|
|
199
|
-
|
|
200
218
|
```typescript
|
|
201
|
-
const rare = getDonenessTemp("
|
|
219
|
+
const rare = getDonenessTemp("beef_steak_ribeye", "rare", "F")
|
|
202
220
|
// Returns: 125
|
|
203
221
|
|
|
204
|
-
const mediumRare = getDonenessTemp("
|
|
222
|
+
const mediumRare = getDonenessTemp("beef_steak_ribeye", "medium_rare", "F")
|
|
205
223
|
// Returns: 135
|
|
206
224
|
|
|
207
|
-
const medium = getDonenessTemp("
|
|
225
|
+
const medium = getDonenessTemp("beef_steak_ribeye", "medium", "C")
|
|
208
226
|
// Returns: 60
|
|
209
227
|
```
|
|
210
228
|
|
|
@@ -213,21 +231,19 @@ const medium = getDonenessTemp("beef-steak-ribeye", "medium", "C")
|
|
|
213
231
|
#### `getCookingMethods(ingredientId: string): CookingMethod[]`
|
|
214
232
|
|
|
215
233
|
Get available cooking methods for an ingredient.
|
|
216
|
-
|
|
217
234
|
```typescript
|
|
218
|
-
const methods = getCookingMethods("
|
|
235
|
+
const methods = getCookingMethods("salmon_fillet")
|
|
219
236
|
// Returns: ["oven_bake", "pan_sear", "grill", "poach", "sous_vide"]
|
|
220
237
|
|
|
221
|
-
const chickenMethods = getCookingMethods("
|
|
238
|
+
const chickenMethods = getCookingMethods("chicken_breast_boneless")
|
|
222
239
|
// Returns: ["oven_bake", "pan_sear", "grill", "poach", "sous_vide", "air_fry"]
|
|
223
240
|
```
|
|
224
241
|
|
|
225
242
|
#### `getCookingInstruction(ingredientId: string, cooking_method: CookingMethod, portionHint?: string): object | undefined`
|
|
226
243
|
|
|
227
244
|
Get detailed cooking instructions for a specific method.
|
|
228
|
-
|
|
229
245
|
```typescript
|
|
230
|
-
const instructions = getCookingInstruction("
|
|
246
|
+
const instructions = getCookingInstruction("salmon_fillet", "oven_bake")
|
|
231
247
|
// Returns:
|
|
232
248
|
// {
|
|
233
249
|
// applianceTemp: 400,
|
|
@@ -238,14 +254,13 @@ const instructions = getCookingInstruction("salmon-fillet", "oven_bake")
|
|
|
238
254
|
// }
|
|
239
255
|
|
|
240
256
|
// With portion hint for specific cuts
|
|
241
|
-
const thickCut = getCookingInstruction("
|
|
257
|
+
const thickCut = getCookingInstruction("beef_steak_ribeye", "grill", "1.5 inch")
|
|
242
258
|
// Returns instructions for 1.5 inch thick steak
|
|
243
259
|
```
|
|
244
260
|
|
|
245
261
|
#### `getQuickReference(query: string, cooking_method?: CookingMethod, unit?: TemperatureUnit): object | undefined`
|
|
246
262
|
|
|
247
263
|
Get a quick reference with all relevant cooking info combined.
|
|
248
|
-
|
|
249
264
|
```typescript
|
|
250
265
|
const ref = getQuickReference("chicken breast", "oven_bake", "F")
|
|
251
266
|
// Returns:
|
|
@@ -323,42 +338,6 @@ For proteins that support doneness preferences:
|
|
|
323
338
|
| `deep_fry` | Submerged in hot oil |
|
|
324
339
|
| `slow_cook` | Low temperature, long duration |
|
|
325
340
|
|
|
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
341
|
## License
|
|
363
342
|
|
|
364
343
|
MIT
|
package/dist/index.d.mts
CHANGED
|
@@ -74,5 +74,9 @@ declare const getQuickReference: (query: string, cooking_method?: CookingMethod,
|
|
|
74
74
|
};
|
|
75
75
|
visualIndicators: string[];
|
|
76
76
|
} | undefined;
|
|
77
|
+
declare const search: (query: string, options?: {
|
|
78
|
+
category?: IngredientCategory;
|
|
79
|
+
limit?: number;
|
|
80
|
+
}) => CookingTemperatureEntry[];
|
|
77
81
|
|
|
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 };
|
|
82
|
+
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, search };
|
package/dist/index.d.ts
CHANGED
|
@@ -74,5 +74,9 @@ declare const getQuickReference: (query: string, cooking_method?: CookingMethod,
|
|
|
74
74
|
};
|
|
75
75
|
visualIndicators: string[];
|
|
76
76
|
} | undefined;
|
|
77
|
+
declare const search: (query: string, options?: {
|
|
78
|
+
category?: IngredientCategory;
|
|
79
|
+
limit?: number;
|
|
80
|
+
}) => CookingTemperatureEntry[];
|
|
77
81
|
|
|
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 };
|
|
82
|
+
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, 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,39 @@ 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
|
+
if (!normalizedQuery) return [];
|
|
1962
|
+
let results = ALL_ENTRIES.filter(
|
|
1963
|
+
(entry) => entry.name.toLowerCase().includes(normalizedQuery) || entry.aliases.some(
|
|
1964
|
+
(alias) => alias.toLowerCase().includes(normalizedQuery)
|
|
1965
|
+
)
|
|
1966
|
+
);
|
|
1967
|
+
if (options?.category) {
|
|
1968
|
+
results = results.filter((entry) => entry.category === options.category);
|
|
1969
|
+
}
|
|
1970
|
+
results.sort((entryA, entryB) => {
|
|
1971
|
+
const aNameLower = entryA.name.toLowerCase();
|
|
1972
|
+
const bNameLower = entryB.name.toLowerCase();
|
|
1973
|
+
const aExact = aNameLower === normalizedQuery;
|
|
1974
|
+
const bExact = bNameLower === normalizedQuery;
|
|
1975
|
+
if (aExact && !bExact) return -1;
|
|
1976
|
+
if (bExact && !aExact) return 1;
|
|
1977
|
+
const aStarts = aNameLower.startsWith(normalizedQuery);
|
|
1978
|
+
const bStarts = bNameLower.startsWith(normalizedQuery);
|
|
1979
|
+
if (aStarts && !bStarts) return -1;
|
|
1980
|
+
if (bStarts && !aStarts) return 1;
|
|
1981
|
+
const aNameContains = aNameLower.includes(normalizedQuery);
|
|
1982
|
+
const bNameContains = bNameLower.includes(normalizedQuery);
|
|
1983
|
+
if (aNameContains && !bNameContains) return -1;
|
|
1984
|
+
if (bNameContains && !aNameContains) return 1;
|
|
1985
|
+
return aNameLower.localeCompare(bNameLower);
|
|
1986
|
+
});
|
|
1987
|
+
if (options?.limit && options.limit > 0) {
|
|
1988
|
+
return results.slice(0, options.limit);
|
|
1989
|
+
}
|
|
1990
|
+
return results;
|
|
1991
|
+
};
|
|
1958
1992
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1959
1993
|
0 && (module.exports = {
|
|
1960
1994
|
convertTemperature,
|
|
@@ -1968,6 +2002,7 @@ var getQuickReference = (query, cooking_method, unit = "F") => {
|
|
|
1968
2002
|
getCookingMethods,
|
|
1969
2003
|
getDonenessTemp,
|
|
1970
2004
|
getQuickReference,
|
|
1971
|
-
getSafeMinimumTemp
|
|
2005
|
+
getSafeMinimumTemp,
|
|
2006
|
+
search
|
|
1972
2007
|
});
|
|
1973
2008
|
//# sourceMappingURL=index.js.map
|