@recipe-book/core 0.0.3 → 0.1.1

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 (185) hide show
  1. package/CHANGELOG.md +116 -0
  2. package/LICENSE +21 -0
  3. package/README.md +50 -7
  4. package/dist/chunk-D5CV3UF7.cjs +2754 -0
  5. package/dist/chunk-D5CV3UF7.cjs.map +1 -0
  6. package/dist/errors.js +76 -0
  7. package/dist/errors.js.map +1 -0
  8. package/dist/format/duration.js +36 -0
  9. package/dist/format/duration.js.map +1 -0
  10. package/dist/format/ingredient.js +49 -0
  11. package/dist/format/ingredient.js.map +1 -0
  12. package/dist/format/number.js +120 -0
  13. package/dist/format/number.js.map +1 -0
  14. package/dist/format/options.js +31 -0
  15. package/dist/format/options.js.map +1 -0
  16. package/dist/format/quantity.js +144 -0
  17. package/dist/format/quantity.js.map +1 -0
  18. package/dist/format/servings.js +68 -0
  19. package/dist/format/servings.js.map +1 -0
  20. package/dist/format/temperature.js +35 -0
  21. package/dist/format/temperature.js.map +1 -0
  22. package/dist/index.cjs +476 -0
  23. package/dist/index.cjs.map +1 -0
  24. package/dist/index.d.cts +994 -0
  25. package/dist/index.d.ts +994 -5
  26. package/dist/index.js +48 -1
  27. package/dist/index.js.map +1 -0
  28. package/dist/ingredient/parse.js +412 -0
  29. package/dist/ingredient/parse.js.map +1 -0
  30. package/dist/issues.js +26 -0
  31. package/dist/issues.js.map +1 -0
  32. package/dist/quantity/amount.js +78 -0
  33. package/dist/quantity/amount.js.map +1 -0
  34. package/dist/quantity/parse.js +255 -0
  35. package/dist/quantity/parse.js.map +1 -0
  36. package/dist/quantity/scale.js +23 -0
  37. package/dist/quantity/scale.js.map +1 -0
  38. package/dist/recipe/duration.js +28 -0
  39. package/dist/recipe/duration.js.map +1 -0
  40. package/dist/recipe/ids.js +68 -0
  41. package/dist/recipe/ids.js.map +1 -0
  42. package/dist/recipe/infer.js +24 -0
  43. package/dist/recipe/infer.js.map +1 -0
  44. package/dist/recipe/nutrient-units.js +18 -0
  45. package/dist/recipe/nutrient-units.js.map +1 -0
  46. package/dist/recipe/nutrition.js +26 -0
  47. package/dist/recipe/nutrition.js.map +1 -0
  48. package/dist/recipe/parse.js +854 -0
  49. package/dist/recipe/parse.js.map +1 -0
  50. package/dist/recipe/schema.js +32 -0
  51. package/dist/recipe/schema.js.map +1 -0
  52. package/dist/recipe/url.js +9 -0
  53. package/dist/recipe/url.js.map +1 -0
  54. package/dist/resolve.js +120 -0
  55. package/dist/resolve.js.map +1 -0
  56. package/dist/schema-org/find.js +158 -0
  57. package/dist/schema-org/find.js.map +1 -0
  58. package/dist/schema-org/from-json-ld.js +647 -0
  59. package/dist/schema-org/from-json-ld.js.map +1 -0
  60. package/dist/schema-org/nutrients.js +19 -0
  61. package/dist/schema-org/nutrients.js.map +1 -0
  62. package/dist/schema-org/text.js +125 -0
  63. package/dist/schema-org/text.js.map +1 -0
  64. package/dist/schema-org/to-json-ld.js +151 -0
  65. package/dist/schema-org/to-json-ld.js.map +1 -0
  66. package/dist/schema-org.cjs +1062 -0
  67. package/dist/schema-org.cjs.map +1 -0
  68. package/dist/schema-org.d.cts +223 -0
  69. package/dist/schema-org.d.ts +223 -0
  70. package/dist/schema-org.js +10 -0
  71. package/dist/schema-org.js.map +1 -0
  72. package/dist/steps/segment.js +45 -0
  73. package/dist/steps/segment.js.map +1 -0
  74. package/dist/steps/temperature.js +174 -0
  75. package/dist/steps/temperature.js.map +1 -0
  76. package/dist/suggest.js +50 -0
  77. package/dist/suggest.js.map +1 -0
  78. package/dist/types-BknM8KOd.d.cts +628 -0
  79. package/dist/types-BknM8KOd.d.ts +628 -0
  80. package/dist/units/convert.js +79 -0
  81. package/dist/units/convert.js.map +1 -0
  82. package/dist/units/lookup.js +86 -0
  83. package/dist/units/lookup.js.map +1 -0
  84. package/dist/units/registry.js +183 -0
  85. package/dist/units/registry.js.map +1 -0
  86. package/dist/units/system.js +91 -0
  87. package/dist/units/system.js.map +1 -0
  88. package/dist/units/temperature.js +40 -0
  89. package/dist/units/temperature.js.map +1 -0
  90. package/dist/validation.js +90 -0
  91. package/dist/validation.js.map +1 -0
  92. package/package.json +53 -8
  93. package/schema-org/package.json +5 -0
  94. package/dist/chunk-22RBQQWH.mjs +0 -1
  95. package/dist/chunk-3CSP4UZG.mjs +0 -1
  96. package/dist/chunk-3FFMHRB7.mjs +0 -26
  97. package/dist/chunk-4EB3HG6B.mjs +0 -50
  98. package/dist/chunk-4EHNJLGI.mjs +0 -50
  99. package/dist/chunk-4IA5EEKI.mjs +0 -81
  100. package/dist/chunk-4TATADPT.mjs +0 -51
  101. package/dist/chunk-6GI5KLI4.mjs +0 -22
  102. package/dist/chunk-6QJZOZ6W.mjs +0 -49
  103. package/dist/chunk-6YYQ4RYZ.mjs +0 -26
  104. package/dist/chunk-7BBUDI2L.mjs +0 -0
  105. package/dist/chunk-7KEMNCV7.mjs +0 -26
  106. package/dist/chunk-7MMJZZ7Z.mjs +0 -75
  107. package/dist/chunk-BES4V7DM.mjs +0 -26
  108. package/dist/chunk-BRDXRIAH.mjs +0 -50
  109. package/dist/chunk-C45UD45A.mjs +0 -1
  110. package/dist/chunk-CBLJXA6P.mjs +0 -1
  111. package/dist/chunk-CFR2ZBPB.mjs +0 -77
  112. package/dist/chunk-DYMNVFL2.mjs +0 -78
  113. package/dist/chunk-F6AQKXJU.mjs +0 -51
  114. package/dist/chunk-FW4M2R43.mjs +0 -51
  115. package/dist/chunk-GCCEDUST.mjs +0 -75
  116. package/dist/chunk-GE7KBYZR.mjs +0 -26
  117. package/dist/chunk-GN7ZDGYC.mjs +0 -51
  118. package/dist/chunk-GOO2SCQX.mjs +0 -75
  119. package/dist/chunk-HAVKBQLH.mjs +0 -51
  120. package/dist/chunk-HCBIPANU.mjs +0 -50
  121. package/dist/chunk-IEBAGBS7.mjs +0 -51
  122. package/dist/chunk-IQ6WN2V4.mjs +0 -75
  123. package/dist/chunk-JB4Z2FR7.mjs +0 -77
  124. package/dist/chunk-JMTQOTBM.mjs +0 -75
  125. package/dist/chunk-JRO6JUES.mjs +0 -51
  126. package/dist/chunk-KH3SRXET.mjs +0 -52
  127. package/dist/chunk-KNZMCAQZ.mjs +0 -51
  128. package/dist/chunk-KXFUCO3R.mjs +0 -1
  129. package/dist/chunk-LEBGCVCJ.mjs +0 -75
  130. package/dist/chunk-MAHWFCIL.mjs +0 -51
  131. package/dist/chunk-MPH76SLC.mjs +0 -51
  132. package/dist/chunk-MQGMFBJQ.mjs +0 -26
  133. package/dist/chunk-NMIVG7T4.mjs +0 -6
  134. package/dist/chunk-Q3TT3AZ4.mjs +0 -26
  135. package/dist/chunk-QY5HJQIL.mjs +0 -51
  136. package/dist/chunk-RCPLSNKM.mjs +0 -1
  137. package/dist/chunk-SR2KFBT3.mjs +0 -1
  138. package/dist/chunk-ULDLBAEG.mjs +0 -1
  139. package/dist/chunk-UQ3EUYFR.mjs +0 -1
  140. package/dist/chunk-V26OCCTL.mjs +0 -82
  141. package/dist/chunk-WBQAMGXK.mjs +0 -0
  142. package/dist/chunk-WSW6FMUL.mjs +0 -51
  143. package/dist/chunk-WU55SBIV.mjs +0 -75
  144. package/dist/chunk-XINK45P3.mjs +0 -51
  145. package/dist/chunk-XNOHIWI3.mjs +0 -1
  146. package/dist/chunk-XV4QN4LA.mjs +0 -6
  147. package/dist/chunk-YHBXEVUX.mjs +0 -51
  148. package/dist/chunk-YSZSCEI7.mjs +0 -75
  149. package/dist/chunk-YY3SUQ7P.mjs +0 -16
  150. package/dist/chunk-YZB3IG47.mjs +0 -80
  151. package/dist/chunk-ZPZT4LMQ.mjs +0 -25
  152. package/dist/const/conversion.d.mts +0 -7
  153. package/dist/const/conversion.d.ts +0 -7
  154. package/dist/const/conversion.js +0 -1
  155. package/dist/const/conversion.mjs +0 -1
  156. package/dist/const/unit.d.mts +0 -119
  157. package/dist/const/unit.d.ts +0 -119
  158. package/dist/const/unit.js +0 -1
  159. package/dist/const/unit.mjs +0 -1
  160. package/dist/index.d.mts +0 -5
  161. package/dist/index.mjs +0 -1
  162. package/dist/lib/assert.d.mts +0 -18
  163. package/dist/lib/assert.d.ts +0 -18
  164. package/dist/lib/assert.js +0 -1
  165. package/dist/lib/assert.mjs +0 -1
  166. package/dist/lib/ingredient.d.mts +0 -9
  167. package/dist/lib/ingredient.d.ts +0 -9
  168. package/dist/lib/ingredient.js +0 -1
  169. package/dist/lib/ingredient.mjs +0 -1
  170. package/dist/lib/recipe.d.mts +0 -12
  171. package/dist/lib/recipe.d.ts +0 -12
  172. package/dist/lib/recipe.js +0 -1
  173. package/dist/lib/recipe.mjs +0 -1
  174. package/dist/lib/runtime.d.mts +0 -3
  175. package/dist/lib/runtime.d.ts +0 -3
  176. package/dist/lib/runtime.js +0 -1
  177. package/dist/lib/runtime.mjs +0 -1
  178. package/dist/lib/unit.d.mts +0 -19
  179. package/dist/lib/unit.d.ts +0 -19
  180. package/dist/lib/unit.js +0 -1
  181. package/dist/lib/unit.mjs +0 -1
  182. package/dist/types.d.mts +0 -36
  183. package/dist/types.d.ts +0 -36
  184. package/dist/types.js +0 -1
  185. package/dist/types.mjs +0 -1
@@ -1,119 +0,0 @@
1
- declare const WEIGHT_UNITS: readonly [{
2
- readonly key: true;
3
- readonly name: "gram";
4
- readonly abbreviation: "g";
5
- readonly value: 1;
6
- readonly type: "weight";
7
- }, {
8
- readonly name: "kilogram";
9
- readonly abbreviation: "kg";
10
- readonly value: 1000;
11
- readonly type: "weight";
12
- }, {
13
- readonly name: "ounce";
14
- readonly abbreviation: "oz";
15
- readonly value: 28.3495;
16
- readonly type: "weight";
17
- }, {
18
- readonly name: "pound";
19
- readonly abbreviation: "lb";
20
- readonly value: 453.592;
21
- readonly type: "weight";
22
- }];
23
- declare const VOLUME_UNITS: readonly [{
24
- readonly key: true;
25
- readonly name: "liter";
26
- readonly abbreviation: "L";
27
- readonly value: 1;
28
- readonly type: "volume";
29
- }, {
30
- readonly name: "gallon";
31
- readonly abbreviation: "gal";
32
- readonly value: 3.78541;
33
- readonly type: "volume";
34
- }, {
35
- readonly name: "milliliter";
36
- readonly abbreviation: "mL";
37
- readonly value: 0.001;
38
- readonly type: "volume";
39
- }, {
40
- readonly name: "cup";
41
- readonly abbreviation: "cup";
42
- readonly value: 0.0625;
43
- readonly type: "volume";
44
- }, {
45
- readonly name: "teaspoon";
46
- readonly abbreviation: "tsp";
47
- readonly value: 0.0208333;
48
- readonly type: "volume";
49
- }, {
50
- readonly name: "tablespoon";
51
- readonly abbreviation: "tbsp";
52
- readonly value: 0.0625;
53
- readonly type: "volume";
54
- }, {
55
- readonly name: "fluid ounce";
56
- readonly abbreviation: "fl oz";
57
- readonly value: 0.125;
58
- readonly type: "volume";
59
- }];
60
- declare const UNITS: ({
61
- readonly key: true;
62
- readonly name: "gram";
63
- readonly abbreviation: "g";
64
- readonly value: 1;
65
- readonly type: "weight";
66
- } | {
67
- readonly name: "kilogram";
68
- readonly abbreviation: "kg";
69
- readonly value: 1000;
70
- readonly type: "weight";
71
- } | {
72
- readonly name: "ounce";
73
- readonly abbreviation: "oz";
74
- readonly value: 28.3495;
75
- readonly type: "weight";
76
- } | {
77
- readonly name: "pound";
78
- readonly abbreviation: "lb";
79
- readonly value: 453.592;
80
- readonly type: "weight";
81
- } | {
82
- readonly key: true;
83
- readonly name: "liter";
84
- readonly abbreviation: "L";
85
- readonly value: 1;
86
- readonly type: "volume";
87
- } | {
88
- readonly name: "gallon";
89
- readonly abbreviation: "gal";
90
- readonly value: 3.78541;
91
- readonly type: "volume";
92
- } | {
93
- readonly name: "milliliter";
94
- readonly abbreviation: "mL";
95
- readonly value: 0.001;
96
- readonly type: "volume";
97
- } | {
98
- readonly name: "cup";
99
- readonly abbreviation: "cup";
100
- readonly value: 0.0625;
101
- readonly type: "volume";
102
- } | {
103
- readonly name: "teaspoon";
104
- readonly abbreviation: "tsp";
105
- readonly value: 0.0208333;
106
- readonly type: "volume";
107
- } | {
108
- readonly name: "tablespoon";
109
- readonly abbreviation: "tbsp";
110
- readonly value: 0.0625;
111
- readonly type: "volume";
112
- } | {
113
- readonly name: "fluid ounce";
114
- readonly abbreviation: "fl oz";
115
- readonly value: 0.125;
116
- readonly type: "volume";
117
- })[];
118
-
119
- export { UNITS, VOLUME_UNITS, WEIGHT_UNITS };
@@ -1 +0,0 @@
1
- var n=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var p=(a,e)=>{for(var o in e)n(a,o,{get:e[o],enumerable:!0})},r=(a,e,o,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of b(e))!m.call(a,t)&&t!==o&&n(a,t,{get:()=>e[t],enumerable:!(i=u(e,t))||i.enumerable});return a};var y=a=>r(n({},"__esModule",{value:!0}),a);var g={};p(g,{UNITS:()=>s,VOLUME_UNITS:()=>v,WEIGHT_UNITS:()=>l});module.exports=y(g);var l=[{key:!0,name:"gram",abbreviation:"g",value:1,type:"weight"},{name:"kilogram",abbreviation:"kg",value:1e3,type:"weight"},{name:"ounce",abbreviation:"oz",value:28.3495,type:"weight"},{name:"pound",abbreviation:"lb",value:453.592,type:"weight"}],v=[{key:!0,name:"liter",abbreviation:"L",value:1,type:"volume"},{name:"gallon",abbreviation:"gal",value:3.78541,type:"volume"},{name:"milliliter",abbreviation:"mL",value:.001,type:"volume"},{name:"cup",abbreviation:"cup",value:.0625,type:"volume"},{name:"teaspoon",abbreviation:"tsp",value:.0208333,type:"volume"},{name:"tablespoon",abbreviation:"tbsp",value:.0625,type:"volume"},{name:"fluid ounce",abbreviation:"fl oz",value:.125,type:"volume"}],s=[...l,...v];0&&(module.exports={UNITS,VOLUME_UNITS,WEIGHT_UNITS});
@@ -1 +0,0 @@
1
- import{a,b,c}from"../chunk-22RBQQWH.mjs";export{c as UNITS,b as VOLUME_UNITS,a as WEIGHT_UNITS};
package/dist/index.d.mts DELETED
@@ -1,5 +0,0 @@
1
- export { RecipeUtils } from './lib/recipe.mjs';
2
- export { UnitUtils } from './lib/unit.mjs';
3
- export { IngredientUtils } from './lib/ingredient.mjs';
4
- export { ConversionTables, GlobalRecipeConfig, Ingredient, IngredientAmount, Instruction, Recipe, RecipeConfig, Unit, UnitAbbreviation, UnitKey, UnitName } from './types.mjs';
5
- import './const/unit.mjs';
package/dist/index.mjs DELETED
@@ -1 +0,0 @@
1
- import"./chunk-WBQAMGXK.mjs";import{a as i}from"./chunk-RCPLSNKM.mjs";import{a as t}from"./chunk-XNOHIWI3.mjs";import"./chunk-KXFUCO3R.mjs";import"./chunk-22RBQQWH.mjs";import{a as r}from"./chunk-UQ3EUYFR.mjs";import"./chunk-C45UD45A.mjs";import"./chunk-3CSP4UZG.mjs";export{i as IngredientUtils,r as RecipeUtils,t as UnitUtils};
@@ -1,18 +0,0 @@
1
- /**
2
- * Throws an error if the assertion fails
3
- *
4
- * @param value - The value to assert
5
- * @param assertion - The assertion to make
6
- * @param message - The message to throw if the assertion fails
7
- */
8
- declare function assert<T>(value: T, assertion: (value: T) => boolean, message: string): void;
9
- /**
10
- * Logs a warning in development if the assertion fails
11
- *
12
- * @param value - The value to assert
13
- * @param assertion - The assertion to make
14
- * @param message - The message to log if the assertion fails
15
- */
16
- declare function warn<T>(value: T, assertion: (value: T) => boolean, message: string): void;
17
-
18
- export { assert, warn };
@@ -1,18 +0,0 @@
1
- /**
2
- * Throws an error if the assertion fails
3
- *
4
- * @param value - The value to assert
5
- * @param assertion - The assertion to make
6
- * @param message - The message to throw if the assertion fails
7
- */
8
- declare function assert<T>(value: T, assertion: (value: T) => boolean, message: string): void;
9
- /**
10
- * Logs a warning in development if the assertion fails
11
- *
12
- * @param value - The value to assert
13
- * @param assertion - The assertion to make
14
- * @param message - The message to log if the assertion fails
15
- */
16
- declare function warn<T>(value: T, assertion: (value: T) => boolean, message: string): void;
17
-
18
- export { assert, warn };
@@ -1 +0,0 @@
1
- var t=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var s=(o,n)=>{for(var r in n)t(o,r,{get:n[r],enumerable:!0})},f=(o,n,r,a)=>{if(n&&typeof n=="object"||typeof n=="function")for(let e of T(n))!l.call(o,e)&&e!==r&&t(o,e,{get:()=>n[e],enumerable:!(a=i(n,e))||a.enumerable});return o};var u=o=>f(t({},"__esModule",{value:!0}),o);var b={};s(b,{assert:()=>w,warn:()=>c});module.exports=u(b);function w(o,n,r){if(!n(o))throw new Error(r)}function c(o,n,r){n(o)||console.warn(r)}0&&(module.exports={assert,warn});
@@ -1 +0,0 @@
1
- import{a,b}from"../chunk-C45UD45A.mjs";export{a as assert,b as warn};
@@ -1,9 +0,0 @@
1
- import { Ingredient, UnitKey } from '../types.mjs';
2
- import '../const/unit.mjs';
3
-
4
- declare class IngredientUtilsImpl {
5
- convert(ingredient: Ingredient, to: UnitKey): Ingredient;
6
- }
7
- declare const IngredientUtils: IngredientUtilsImpl;
8
-
9
- export { IngredientUtils };
@@ -1,9 +0,0 @@
1
- import { Ingredient, UnitKey } from '../types.js';
2
- import '../const/unit.js';
3
-
4
- declare class IngredientUtilsImpl {
5
- convert(ingredient: Ingredient, to: UnitKey): Ingredient;
6
- }
7
- declare const IngredientUtils: IngredientUtilsImpl;
8
-
9
- export { IngredientUtils };
@@ -1 +0,0 @@
1
- var i=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var U=Object.prototype.hasOwnProperty;var f=(n,e)=>{for(var t in e)i(n,t,{get:e[t],enumerable:!0})},E=(n,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of T(e))!U.call(n,a)&&a!==t&&i(n,a,{get:()=>e[a],enumerable:!(o=L(e,a))||o.enumerable});return n};var N=n=>E(i({},"__esModule",{value:!0}),n);var h={};f(h,{IngredientUtils:()=>I});module.exports=N(h);var v={g:{g:1,kg:1e3,oz:28.3495,lb:453.592},kg:{g:.001,kg:1,oz:.0283495,lb:.453592},oz:{g:.035274,kg:35.274,oz:1,lb:16},lb:{g:.00220462,kg:2.20462,oz:.0625,lb:1}},m={L:{L:1,gal:3.78541,mL:.001,cup:.0625,tsp:.202884,tbsp:.067628},gal:{L:.264172,gal:1,mL:264172e-9,cup:.016,tsp:.0515037,tbsp:.0171679},mL:{L:1e3,gal:3785.41,mL:1,cup:.00422675,tsp:.033814,tbsp:.00422675},cup:{L:4.22675,gal:16,mL:236.588,cup:1,tsp:3.2,tbsp:1.06667},tsp:{L:4.92892,gal:18.6184,mL:4.92892,cup:.3125,tsp:1,tbsp:.333333},tbsp:{L:14.7868,gal:56,mL:14.7868,cup:.9375,tsp:3,tbsp:1}};var k=[{key:!0,name:"gram",abbreviation:"g",value:1,type:"weight"},{name:"kilogram",abbreviation:"kg",value:1e3,type:"weight"},{name:"ounce",abbreviation:"oz",value:28.3495,type:"weight"},{name:"pound",abbreviation:"lb",value:453.592,type:"weight"}],w=[{key:!0,name:"liter",abbreviation:"L",value:1,type:"volume"},{name:"gallon",abbreviation:"gal",value:3.78541,type:"volume"},{name:"milliliter",abbreviation:"mL",value:.001,type:"volume"},{name:"cup",abbreviation:"cup",value:.0625,type:"volume"},{name:"teaspoon",abbreviation:"tsp",value:.0208333,type:"volume"},{name:"tablespoon",abbreviation:"tbsp",value:.0625,type:"volume"},{name:"fluid ounce",abbreviation:"fl oz",value:.125,type:"volume"}],c=[...k,...w];function r(n,e,t){if(!e(n))throw new Error(t)}var s=class{getUnit(e){let t=c.find(o=>o.abbreviation===e||o.name===e);return r(t,o=>!!o,`No unit found for key: ${e}`),t}getConversionRatio(e,t){let{type:o,abbreviation:a}=this.getUnit(e),p=(o==="volume"?m:v)[a],u=t==="metric"?o==="volume"?"L":"g":t;return r(p,y=>!!y[u],`No conversion table available for unit ${e} to ${t}`),p[u]}convert(e,t,o){if(t===o)return e;let a=this.getConversionRatio(t,o),b=e*a;return Math.round(b*100)/100}},g=new s;var l=class{convert(e,t){let o=g.convert(e.amount.value,e.amount.unit,t);return{...e,amount:{value:o,unit:t}}}},I=new l;0&&(module.exports={IngredientUtils});
@@ -1 +0,0 @@
1
- import{a}from"../chunk-RCPLSNKM.mjs";import"../chunk-XNOHIWI3.mjs";import"../chunk-KXFUCO3R.mjs";import"../chunk-22RBQQWH.mjs";import"../chunk-C45UD45A.mjs";export{a as IngredientUtils};
@@ -1,12 +0,0 @@
1
- import { RecipeConfig, Recipe } from '../types.mjs';
2
- import '../const/unit.mjs';
3
-
4
- declare class RecipeUtilsImpl {
5
- private scopedMessageFactory;
6
- private validateConfig;
7
- private determineMeasurementSystem;
8
- create(config: RecipeConfig): Recipe;
9
- }
10
- declare const RecipeUtils: RecipeUtilsImpl;
11
-
12
- export { RecipeUtils };
@@ -1,12 +0,0 @@
1
- import { RecipeConfig, Recipe } from '../types.js';
2
- import '../const/unit.js';
3
-
4
- declare class RecipeUtilsImpl {
5
- private scopedMessageFactory;
6
- private validateConfig;
7
- private determineMeasurementSystem;
8
- create(config: RecipeConfig): Recipe;
9
- }
10
- declare const RecipeUtils: RecipeUtilsImpl;
11
-
12
- export { RecipeUtils };
@@ -1 +0,0 @@
1
- var o=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var l=(s,e)=>{for(var t in e)o(s,t,{get:e[t],enumerable:!0})},d=(s,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of p(e))!c.call(s,r)&&r!==t&&o(s,r,{get:()=>e[r],enumerable:!(n=m(e,r))||n.enumerable});return s};var h=s=>d(o({},"__esModule",{value:!0}),s);var v={};l(v,{RecipeUtils:()=>f});module.exports=h(v);function a(s,e,t){e(s)||console.warn(t)}var u=class{scopedMessageFactory(e){return t=>`${e.name}: ${t}`}validateConfig(e){if(!!0)return;let t=this.scopedMessageFactory(e);a(e.instructions,n=>n.length>0,t("Recipe has no instructions")),a(e.serves,n=>n===void 0||n>0,t("Recipe serves less than 1 person")),a(e.ingredients,n=>n.length>0,t("Recipe has no ingredients"))}determineMeasurementSystem(e){let{ingredients:t}=e,n=t.some(i=>i.amount.unit==="g"),r=t.some(i=>i.amount.unit==="oz"||i.amount.unit==="fl oz"||i.amount.unit==="lb"||i.amount.unit==="cup");if(!(n&&r)){if(n)return"metric";if(r)return"us-customary"}}create(e){return this.validateConfig(e),{name:e.name,ingredients:e.ingredients,thumbnail:e.thumbnail,serves:e.serves??1,instructions:e.instructions??[],measurements:e.measurements??this.determineMeasurementSystem(e)}}},f=new u;0&&(module.exports={RecipeUtils});
@@ -1 +0,0 @@
1
- import{a}from"../chunk-UQ3EUYFR.mjs";import"../chunk-C45UD45A.mjs";import"../chunk-3CSP4UZG.mjs";export{a as RecipeUtils};
@@ -1,3 +0,0 @@
1
- declare const IS_DEV = true;
2
-
3
- export { IS_DEV };
@@ -1,3 +0,0 @@
1
- declare const IS_DEV = true;
2
-
3
- export { IS_DEV };
@@ -1 +0,0 @@
1
- var c=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var x=(e,t)=>{for(var r in t)c(e,r,{get:t[r],enumerable:!0})},D=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of s(t))!u.call(e,o)&&o!==r&&c(e,o,{get:()=>t[o],enumerable:!(n=p(t,o))||n.enumerable});return e};var E=e=>D(c({},"__esModule",{value:!0}),e);var S={};x(S,{IS_DEV:()=>I});module.exports=E(S);var I=!0;0&&(module.exports={IS_DEV});
@@ -1 +0,0 @@
1
- import{a}from"../chunk-3CSP4UZG.mjs";export{a as IS_DEV};
@@ -1,19 +0,0 @@
1
- import { UnitKey } from '../types.mjs';
2
- import '../const/unit.mjs';
3
-
4
- declare class UnitUtilsImpl {
5
- private getUnit;
6
- private getConversionRatio;
7
- /**
8
- * Converts a number from one unit to another
9
- *
10
- * @param amount - The amount to convert
11
- * @param from - The unit to convert from
12
- * @param to - The unit to convert to
13
- * @returns - The converted amount
14
- */
15
- convert(amount: number, from: UnitKey, to: UnitKey): number;
16
- }
17
- declare const UnitUtils: UnitUtilsImpl;
18
-
19
- export { UnitUtils };
@@ -1,19 +0,0 @@
1
- import { UnitKey } from '../types.js';
2
- import '../const/unit.js';
3
-
4
- declare class UnitUtilsImpl {
5
- private getUnit;
6
- private getConversionRatio;
7
- /**
8
- * Converts a number from one unit to another
9
- *
10
- * @param amount - The amount to convert
11
- * @param from - The unit to convert from
12
- * @param to - The unit to convert to
13
- * @returns - The converted amount
14
- */
15
- convert(amount: number, from: UnitKey, to: UnitKey): number;
16
- }
17
- declare const UnitUtils: UnitUtilsImpl;
18
-
19
- export { UnitUtils };
package/dist/lib/unit.js DELETED
@@ -1 +0,0 @@
1
- var i=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames;var T=Object.prototype.hasOwnProperty;var y=(n,e)=>{for(var t in e)i(n,t,{get:e[t],enumerable:!0})},U=(n,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of L(e))!T.call(n,a)&&a!==t&&i(n,a,{get:()=>e[a],enumerable:!(o=g(e,a))||o.enumerable});return n};var E=n=>U(i({},"__esModule",{value:!0}),n);var h={};y(h,{UnitUtils:()=>k});module.exports=E(h);var v={g:{g:1,kg:1e3,oz:28.3495,lb:453.592},kg:{g:.001,kg:1,oz:.0283495,lb:.453592},oz:{g:.035274,kg:35.274,oz:1,lb:16},lb:{g:.00220462,kg:2.20462,oz:.0625,lb:1}},u={L:{L:1,gal:3.78541,mL:.001,cup:.0625,tsp:.202884,tbsp:.067628},gal:{L:.264172,gal:1,mL:264172e-9,cup:.016,tsp:.0515037,tbsp:.0171679},mL:{L:1e3,gal:3785.41,mL:1,cup:.00422675,tsp:.033814,tbsp:.00422675},cup:{L:4.22675,gal:16,mL:236.588,cup:1,tsp:3.2,tbsp:1.06667},tsp:{L:4.92892,gal:18.6184,mL:4.92892,cup:.3125,tsp:1,tbsp:.333333},tbsp:{L:14.7868,gal:56,mL:14.7868,cup:.9375,tsp:3,tbsp:1}};var N=[{key:!0,name:"gram",abbreviation:"g",value:1,type:"weight"},{name:"kilogram",abbreviation:"kg",value:1e3,type:"weight"},{name:"ounce",abbreviation:"oz",value:28.3495,type:"weight"},{name:"pound",abbreviation:"lb",value:453.592,type:"weight"}],f=[{key:!0,name:"liter",abbreviation:"L",value:1,type:"volume"},{name:"gallon",abbreviation:"gal",value:3.78541,type:"volume"},{name:"milliliter",abbreviation:"mL",value:.001,type:"volume"},{name:"cup",abbreviation:"cup",value:.0625,type:"volume"},{name:"teaspoon",abbreviation:"tsp",value:.0208333,type:"volume"},{name:"tablespoon",abbreviation:"tbsp",value:.0625,type:"volume"},{name:"fluid ounce",abbreviation:"fl oz",value:.125,type:"volume"}],c=[...N,...f];function r(n,e,t){if(!e(n))throw new Error(t)}var b=class{getUnit(e){let t=c.find(o=>o.abbreviation===e||o.name===e);return r(t,o=>!!o,`No unit found for key: ${e}`),t}getConversionRatio(e,t){let{type:o,abbreviation:a}=this.getUnit(e),l=(o==="volume"?u:v)[a],p=t==="metric"?o==="volume"?"L":"g":t;return r(l,m=>!!m[p],`No conversion table available for unit ${e} to ${t}`),l[p]}convert(e,t,o){if(t===o)return e;let a=this.getConversionRatio(t,o),s=e*a;return Math.round(s*100)/100}},k=new b;0&&(module.exports={UnitUtils});
package/dist/lib/unit.mjs DELETED
@@ -1 +0,0 @@
1
- import{a}from"../chunk-XNOHIWI3.mjs";import"../chunk-KXFUCO3R.mjs";import"../chunk-22RBQQWH.mjs";import"../chunk-C45UD45A.mjs";export{a as UnitUtils};
package/dist/types.d.mts DELETED
@@ -1,36 +0,0 @@
1
- import { UNITS } from './const/unit.mjs';
2
-
3
- type ConversionTables = 'us-customary' | 'metric';
4
- type Unit = (typeof UNITS)[number];
5
- type UnitName = Unit['name'];
6
- type UnitAbbreviation = Unit['abbreviation'];
7
- type UnitKey = UnitName | UnitAbbreviation;
8
- type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
9
- type IngredientAmount = {
10
- value: number;
11
- unit: UnitKey;
12
- };
13
- type Ingredient = {
14
- name: string;
15
- amount: IngredientAmount;
16
- conversion?: Partial<Record<ConversionTables, IngredientAmount | UnitKey>>;
17
- notes?: string;
18
- };
19
- type Instruction = {
20
- name: string;
21
- description: string;
22
- image?: string;
23
- };
24
- type GlobalRecipeConfig = {};
25
- type Recipe = GlobalRecipeConfig & {
26
- name: string;
27
- thumbnail?: string;
28
- ingredients: Ingredient[];
29
- serves: number;
30
- instructions: string[];
31
- measurements?: ConversionTables;
32
- };
33
- type recipeOmittableKeys = 'serves';
34
- type RecipeConfig = PartialBy<Recipe, recipeOmittableKeys>;
35
-
36
- export type { ConversionTables, GlobalRecipeConfig, Ingredient, IngredientAmount, Instruction, Recipe, RecipeConfig, Unit, UnitAbbreviation, UnitKey, UnitName };
package/dist/types.d.ts DELETED
@@ -1,36 +0,0 @@
1
- import { UNITS } from './const/unit.js';
2
-
3
- type ConversionTables = 'us-customary' | 'metric';
4
- type Unit = (typeof UNITS)[number];
5
- type UnitName = Unit['name'];
6
- type UnitAbbreviation = Unit['abbreviation'];
7
- type UnitKey = UnitName | UnitAbbreviation;
8
- type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
9
- type IngredientAmount = {
10
- value: number;
11
- unit: UnitKey;
12
- };
13
- type Ingredient = {
14
- name: string;
15
- amount: IngredientAmount;
16
- conversion?: Partial<Record<ConversionTables, IngredientAmount | UnitKey>>;
17
- notes?: string;
18
- };
19
- type Instruction = {
20
- name: string;
21
- description: string;
22
- image?: string;
23
- };
24
- type GlobalRecipeConfig = {};
25
- type Recipe = GlobalRecipeConfig & {
26
- name: string;
27
- thumbnail?: string;
28
- ingredients: Ingredient[];
29
- serves: number;
30
- instructions: string[];
31
- measurements?: ConversionTables;
32
- };
33
- type recipeOmittableKeys = 'serves';
34
- type RecipeConfig = PartialBy<Recipe, recipeOmittableKeys>;
35
-
36
- export type { ConversionTables, GlobalRecipeConfig, Ingredient, IngredientAmount, Instruction, Recipe, RecipeConfig, Unit, UnitAbbreviation, UnitKey, UnitName };
package/dist/types.js DELETED
@@ -1 +0,0 @@
1
- var r=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var m=(t,e,o,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of s(e))!a.call(t,n)&&n!==o&&r(t,n,{get:()=>e[n],enumerable:!(i=p(e,n))||i.enumerable});return t};var y=t=>m(r({},"__esModule",{value:!0}),t);var g={};module.exports=y(g);
package/dist/types.mjs DELETED
@@ -1 +0,0 @@
1
- import"./chunk-WBQAMGXK.mjs";