@mark1russell7/stack-needs 0.5.0 → 0.7.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.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @mark1russell7/stack-needs
2
2
 
3
- The need rates of draws as reference data. Each rate has its source and its license. The first table is the food energy that each person needs each day.
3
+ The need rates of draws as reference data. Each rate has its source and its license. The first tables are the food energy that each person needs each day.
4
4
 
5
5
  It is an add-on of [`@mark1russell7/system-stack`](../system-stack/README.md). It makes a fragment of an endurance layer, and [`@mark1russell7/stack-endurance`](../stack-endurance/README.md) calculates with it. The data names no person and no place. The persons of a household are input data.
6
6
 
@@ -11,6 +11,7 @@ Each function is a plain function with no clock, no network and no file.
11
11
  | Record | What it tells |
12
12
  | --- | --- |
13
13
  | `CalorieTable` | A table of estimated calorie needs from one source, with the place of the tables in the source. |
14
+ | `CalorieTables` | One table, or tables in order. For each person, the first table with a row for the age gives the need. |
14
15
  | `CalorieRow` | A sex, a range of ages in months, and the need of each activity level, or one need for all levels. |
15
16
  | `CalorieChange` | A stage (for example `pregnancy-2`), a sex, and the change of the daily need at that stage, with the condition of the source. |
16
17
  | `Person` | A group of persons: a sex, an age in whole months, a count and, as options, an activity level and a stage. |
@@ -19,12 +20,16 @@ Each function is a plain function with no clock, no network and no file.
19
20
  ## The rules of the data
20
21
 
21
22
  1. Each value comes from a table of a cited source. A value with no source is not data.
22
- 2. An age with no row in the table gives a line with no read for that person, not an error. The total of `calorieNeed` is then a lower limit, and `read` is false.
23
+ 2. An age with no row in the tables gives a line with no read for that person, not an error. The total of `calorieNeed` is then a lower limit, and `read` is false.
23
24
  3. The activity level is an explicit input. The package has no default level.
24
- 4. A stage of pregnancy or lactation is an input of a person record. `calorieNeed` adds the change of the stage to the need of the row. A stage that the table does not have for the sex of the record is an error, not a no read. Thus the option `leave-out` cannot remove a pregnant person from a draw. One stage holds for each day of a call. For a period that crosses stages, the planner selects the stage, for example the stage with the largest change.
25
+ 4. A stage of pregnancy or lactation is an input of a person record. `calorieNeed` adds the change of the stage to the need of the row. The change comes from the table of the row. A stage that this table does not have for the sex of the record is an error, not a no read. Thus the option `leave-out` cannot remove a pregnant person from a draw. One stage holds for each day of a call. For a period that crosses stages, the planner selects the stage, for example the stage with the largest change.
25
26
  5. The package has no cooking converter. No cited source gives the water and the fuel to cook 1 kg of dry food.
26
27
 
27
- `checkCalorieTable` is the gate of a table. It gives the findings of `checkSources` of `@mark1russell7/guidebook` for the source, also for a hash that is not 64 lowercase hexadecimal digits (`bad-sha256`). The source of a table must have a publisher (`by`), a page of its terms and a hash, and HTTPS addresses (the options `require` and `https` of the gate). A missing field gives `missing-field`. For the rows, it refuses two rows of one sex with ages in common, and a need that is not above 0 in `kcal/d`. The rows of each sex also cover each month with no gap, from the first row to an open last row (`needs-gap`). Each change has a stage, a title, a sex of the table and a finite value in `kcal/d`. Each stage and sex has one change at most (`needs-change`).
28
+ `checkCalorieTable` is the gate of a table. It gives the findings of `checkSources` of `@mark1russell7/guidebook` for the source, also for a hash that is not 64 lowercase hexadecimal digits (`bad-sha256`). The source of a table must have a publisher (`by`), a page of its terms and a hash, and HTTPS addresses (the options `require` and `https` of the gate). A missing field gives `missing-field`. For the rows, it refuses two rows of one sex with ages in common, and a need that is not above 0 in `kcal/d`. The rows of each sex have no gap between two rows (`needs-gap`). A table can start after month 0 and end at a closed row. Each change has a stage, a title, a sex of the table and a finite value in `kcal/d`. Each stage and sex has one change at most (`needs-change`).
29
+
30
+ `checkCalorieChain` is the gate of tables in order. It gives the findings of `checkCalorieTable` for each table. Two tables with the same `id` give `needs-id`.
31
+
32
+ Then, for each sex, the rows of all the tables must cover each month from 0 to an open last row (`needs-gap`, record `chain`). Before 0.6.0, `checkCalorieTable` refused a table with a closed last row.
28
33
 
29
34
  The source of a table is the `Source` of `@mark1russell7/guidebook`, with its field `sha256`. Before 0.3.0, the package had its own type `HashedSource` and the code `needs-hash`.
30
35
 
@@ -71,9 +76,31 @@ The result has two reads. `needRead` tells if the draw has a read, and `storesRe
71
76
 
72
77
  ### A person with no row
73
78
 
74
- The table has no row below 12 months. By default, a person with no row gives no layer. The result has `layer: undefined`, the persons with no row and the reason. A low rate gives too many days, and the draw has no field for a no read. A draw of 0 kcal also gives no layer: a household with no person, or each count 0.
79
+ The default tables are `CALORIE_CHAIN`: the guidelines, then the infant table. They give a row for each age. A table of the option `table` can have no row for an age. By default, a person with no row gives no layer. The result has `layer: undefined`, the persons with no row and the reason. A low rate gives too many days, and the draw has no field for a no read. A draw of 0 kcal also gives no layer: a household with no person, or each count 0.
80
+
81
+ The option `noRow: "leave-out"` leaves those persons out of the draw. The users are then the persons with a row, and `leftOut` lists the other persons. The draw then has no need of those persons.
82
+
83
+ The days are then an upper limit for the whole household.
84
+
85
+ ### An infant
86
+
87
+ The infant table gives the need of an infant below 12 months (`INFANT_MONTHS`). Each person record below 12 months must have the field `feeding`. It has no default, because each way gives a different draw.
88
+
89
+ | `feeding` | The draw of food energy |
90
+ | --- | --- |
91
+ | `food` | The draw holds the need of the infant, from the infant table. |
92
+ | `breast-milk` | Only below 6 months (`BREAST_MILK_MONTHS`). The draw does not hold the need of the infant. The milk comes from the food of the mother, so the stage of lactation of the mother holds that energy. The result lists the infant in `breastMilk`. |
93
+ | `formula` | Only below 12 months. The fragment has no draw of formula. Thus the infant gives no layer, as a person with no row. The result lists the infant in `formula`. With `noRow: "leave-out"`, the draw has no need of the infant, and `leftOut` lists the infant. |
75
94
 
76
- The option `noRow: "leave-out"` leaves those persons out of the draw. The users are then the persons with a row, and `leftOut` lists the other persons. The draw then has no need of those persons. For an infant, that need is breast milk or formula, not the buy list. The days are then an upper limit for the whole household.
95
+ With the default tables, the line of each infant in `need` has a read, so `need` gives the energy of the whole household.
96
+
97
+ The rules of breast milk:
98
+
99
+ - A person of the household must have a stage of lactation, or the function gives a `RangeError`.
100
+ - The change of a stage is the milk of one infant. Thus each infant on breast milk needs one person of the draw with a stage of lactation. When the infants are more, the function gives no layer, also with `leave-out`. A person that the draw leaves out does not count.
101
+ - From 6 months, the infant table gives 604 to 745 kcal/d, and the change of the stage is 400 kcal/d. Thus a part of the need is in no draw, and the function gives a `RangeError`. Give `food` from 6 months.
102
+
103
+ A stage of lactation is a change with `milk: true`: `lactation-1` and `lactation-2` of the guidelines. From 6 months, an infant eats food and drinks milk. With `feeding: "food"` and the stage `lactation-2` of the mother, the draw counts a part of that energy two times. The result is then more food than the household needs, which is on the safe side.
77
104
 
78
105
  ### The resources of the buy list and the join
79
106
 
@@ -133,10 +160,19 @@ The guidelines are a work of the United States federal government, in the public
133
160
  - The source gives each need for a reference height and weight. A person can need more or less.
134
161
  - The source gives the changes of Table A2-3 for women with a healthy weight before the pregnancy. Each change has this condition in its field `condition`.
135
162
 
163
+ The infant table comes from the report Dietary Reference Intakes for Energy (2023) of the National Academies of Sciences, Engineering, and Medicine (DOI 10.17226/26818). Table 7-5 gives the boys of 0 to 35 months, on page 160. Table 7-6 gives the girls of 0 to 35 months, on page 161. The table has 24 rows: one row for each group of 3 months and each sex.
164
+
165
+ The report gives each need for the median length and weight of the age group in the United States.
166
+
167
+ The report is all rights reserved (the license `all-rights-reserved` of guidebook). The table cites its values as facts and copies no text, and the gate of the sources permits this use. The record of the source has the SHA-256 hash of the PDF of the check of 2026-11-24. The Infant Nutrition and Feeding guide of the WIC program of the USDA gives no table of daily needs (read on 2026-11-24).
168
+
169
+ - The rows of 12 to 35 months are also in the table. In `CALORIE_CHAIN`, the guidelines come first, so they give the need of those ages.
170
+ - A table with the report first gives the needs of the report up to 35 months.
171
+
136
172
  The 2025-2030 edition of the guidelines was read on 2026-11-24. It has no table of calorie needs. It sends the reader to the DRI calculator of the USDA, and its daily servings start from a calorie level. Thus the table stays the table of the 2020-2025 edition.
137
173
 
138
174
  ## The entries
139
175
 
140
176
  | Entry | What it has |
141
177
  | --- | --- |
142
- | `@mark1russell7/stack-needs` | The records, the calorie table, the gate, `calorieNeed`, `householdFragment`, the uses, the supply parts and `checkJoins`. |
178
+ | `@mark1russell7/stack-needs` | The records, the calorie tables and `CALORIE_CHAIN`, the gates, `calorieNeed`, `householdFragment`, the uses, the supply parts and `checkJoins`. |
package/build/index.d.ts CHANGED
@@ -46,6 +46,8 @@ export interface CalorieChange {
46
46
  readonly change: Quantity;
47
47
  /** The condition of the source for the change, for example a healthy weight before the pregnancy. */
48
48
  readonly condition?: string | undefined;
49
+ /** True when the persons of the stage make the milk of an infant: a stage of lactation. */
50
+ readonly milk?: true | undefined;
49
51
  }
50
52
  /** A table of estimated calorie needs from one source. */
51
53
  export interface CalorieTable {
@@ -60,6 +62,21 @@ export interface CalorieTable {
60
62
  /** The changes of the need at each stage. The stage and the sex of each change are unique. */
61
63
  readonly changes?: readonly CalorieChange[] | undefined;
62
64
  }
65
+ /**
66
+ * One table, or tables in order. For each person, the first table with a row for the age gives the need.
67
+ * An example is `CALORIE_CHAIN`: the guidelines from 12 months, and the infant table below 12 months.
68
+ */
69
+ export type CalorieTables = CalorieTable | readonly CalorieTable[];
70
+ /**
71
+ * The ways to feed an infant.
72
+ *
73
+ * - `breast-milk`: only the milk of a person of the household.
74
+ * - `formula`: infant formula.
75
+ * - `food`: the food of the household, also with milk.
76
+ */
77
+ export declare const INFANT_FEEDINGS: readonly ["breast-milk", "formula", "food"];
78
+ /** A way to feed an infant. */
79
+ export type InfantFeeding = (typeof INFANT_FEEDINGS)[number];
63
80
  /** A group of persons of the same sex and age, and their count. */
64
81
  export interface Person {
65
82
  readonly sex: CalorieSex;
@@ -70,12 +87,18 @@ export interface Person {
70
87
  readonly level?: ActivityLevel | undefined;
71
88
  /** The stage of the persons, for example `pregnancy-2`: the stage of a change of the table. Without it, no change applies. */
72
89
  readonly stage?: string | undefined;
90
+ /**
91
+ * The way to feed the persons. The household fragment must have it for each record below `INFANT_MONTHS`.
92
+ * `calorieNeed` does not read it, because the energy need is the same.
93
+ */
94
+ readonly feeding?: InfantFeeding | undefined;
73
95
  }
74
96
  /** The need of one person record for the days, or no read when the table has no row for the age. */
75
97
  export type CalorieNeedLine = {
76
98
  readonly person: Person;
77
99
  readonly read: true;
78
100
  readonly level: ActivityLevel;
101
+ readonly table: string;
79
102
  readonly row: string;
80
103
  readonly stage?: string | undefined;
81
104
  readonly need: Quantity;
@@ -105,6 +128,18 @@ export declare function isActivityLevel(level: unknown): level is ActivityLevel;
105
128
  * @param ageMonths - The age, in whole months
106
129
  */
107
130
  export declare function calorieRow(table: CalorieTable, sex: CalorieSex, ageMonths: number): CalorieRow | undefined;
131
+ /**
132
+ * This function gives the first table with a row for a sex and an age in months, and its row.
133
+ * It gives `undefined` when no table has a row.
134
+ *
135
+ * @param tables - One table, or tables in order
136
+ * @param sex - The sex
137
+ * @param ageMonths - The age, in whole months
138
+ */
139
+ export declare function calorieRowOf(tables: CalorieTables, sex: CalorieSex, ageMonths: number): {
140
+ readonly table: CalorieTable;
141
+ readonly row: CalorieRow;
142
+ } | undefined;
108
143
  /**
109
144
  * This function gives the change of a table for a sex and a stage, or `undefined` when the table has no such change.
110
145
  *
@@ -115,49 +150,66 @@ export declare function calorieRow(table: CalorieTable, sex: CalorieSex, ageMont
115
150
  export declare function calorieChange(table: CalorieTable, sex: CalorieSex, stage: string): CalorieChange | undefined;
116
151
  /**
117
152
  * This function gives the energy need of the persons of a household for a count of days, in `kcal`.
118
- * It adds the need of each person at the activity level of that person. The table finds the row of each person from the age.
153
+ * It adds the need of each person at the activity level of that person. The first table with a row for the age of a person gives the row.
119
154
  *
120
- * - An age with no row in the table gives a line with no read, for example 6 months. Then the total is a lower limit.
155
+ * - An age with no row in the tables gives a line with no read, for example 6 months in `DGA_CALORIES` alone. Then the total is a lower limit.
156
+ * - Each line with a read has the `id` of the table of its row.
121
157
  * - The table of the toddlers gives one need for each age and sex. Thus the level does not change the need of a toddler.
122
- * - A record with a stage adds the change of the stage to the need of its row, for example 340 kcal/d in the second trimester.
158
+ * - A record with a stage adds the change of the stage to the need of its row, for example 340 kcal/d in the second trimester. The change comes from the table of the row.
123
159
  * - One stage holds for each day of the call. For a period that crosses stages, the planner selects the stage, for example the stage with the largest change.
124
160
  *
125
161
  * The activity level is an explicit input. This package has no default level. The planner selects it, also for the worst case of a long power cut.
126
162
  * In that case, work can make the level higher, for example the carry of water. The function is pure.
127
163
  *
128
- * @param table - The table of calorie needs
164
+ * @param tables - The table of calorie needs, or tables in order
129
165
  * @param persons - The person records of the household: a sex, an age in months, a count and, as an option, a level
130
166
  * @param level - The activity level of each record with no level of its own
131
167
  * @param days - The count of days, a finite number of 0 or more
132
168
  * @throws RangeError when a count of persons or an age is not a whole number of 0 or more, or when the household has no person
133
169
  * @throws RangeError when a level is not a level of the table, or when a sex is not a sex of the table
134
- * @throws RangeError when the count of days is not a finite number of 0 or more
135
- * @throws RangeError when the table has no change for the stage and the sex of a record
170
+ * @throws RangeError when the count of days is not a finite number of 0 or more, or when the list of tables is empty
171
+ * @throws RangeError when no table has the change for the stage and the sex of a record
172
+ * @throws RangeError when the table of the row of a record has no change for the stage and the sex of the record
136
173
  * @throws RangeError when the daily need of a record, with the change of its stage, is not above 0
137
174
  */
138
- export declare function calorieNeed(table: CalorieTable, persons: readonly Person[], level: ActivityLevel, days: number): CalorieNeedTotal;
175
+ export declare function calorieNeed(tables: CalorieTables, persons: readonly Person[], level: ActivityLevel, days: number): CalorieNeedTotal;
139
176
  /** The source of the calorie table: the PDF of the Dietary Guidelines for Americans, 2020-2025, 9th Edition. It is a work of the United States federal government. */
140
177
  export declare const DGA_SOURCE: Source;
141
178
  /** The table of estimated calorie needs of the Dietary Guidelines for Americans, 2020-2025: 68 rows, 34 for each sex, and 5 changes of pregnancy and lactation. */
142
179
  export declare const DGA_CALORIES: CalorieTable;
180
+ /** The source of the infant table: the PDF of the report Dietary Reference Intakes for Energy (2023) of the National Academies. */
181
+ export declare const NASEM_ENERGY_SOURCE: Source;
182
+ /**
183
+ * The table of the Estimated Energy Requirements of the ages of 0 to 35 months, from the report Dietary Reference Intakes
184
+ * for Energy (2023): 24 rows, 12 for each sex. Each row gives one need for each age group and sex. The last row ends at
185
+ * 35 months, so the table is for a chain of tables, for example `CALORIE_CHAIN`.
186
+ */
187
+ export declare const NASEM_INFANT_CALORIES: CalorieTable;
143
188
  /** The tables of estimated calorie needs, one record for each source. */
144
189
  export declare const CALORIE_TABLES: readonly CalorieTable[];
190
+ /**
191
+ * The default tables of `householdFragment`, in order: the guidelines first, then the infant table. The guidelines give
192
+ * each age from 12 months. The infant table gives the ages below 12 months. Together they give a row for each age.
193
+ */
194
+ export declare const CALORIE_CHAIN: readonly CalorieTable[];
145
195
  /**
146
196
  * These are the codes of the gate of the rows. Each code is an error. The gate of the sources of `@mark1russell7/guidebook` gives its own codes.
147
197
  *
148
198
  * - `needs-row`: a row has no age or a wrong sex. Or its range of months is not a range of whole numbers of 0 or more.
149
199
  * - `needs-overlap`: two rows of one sex have ages in common.
150
- * - `needs-gap`: the rows of one sex do not cover each month with no gap, from the first row to an open last row.
200
+ * - `needs-gap`: the rows of one sex in a table have a gap between two rows. Or the rows of one sex in a chain of tables
201
+ * do not cover each month from 0 to an open last row.
151
202
  * - `needs-value`: a need is not a finite number above 0 in a unit of energy for each day.
152
203
  * - `needs-change`: a change has no stage, no title or a wrong sex, or a stage with a space at an end. Or a different
153
204
  * change has its stage and sex. Or its value is not a finite number in a unit of energy for each day. Or its sum with
154
205
  * the smallest need of its sex is not above 0.
206
+ * - `needs-id`: two tables of a chain have the same `id`. Each line of a need names its table by the `id`.
155
207
  */
156
- export declare const NEEDS_CODES: readonly ["needs-row", "needs-overlap", "needs-gap", "needs-value", "needs-change"];
208
+ export declare const NEEDS_CODES: readonly ["needs-row", "needs-overlap", "needs-gap", "needs-value", "needs-change", "needs-id"];
157
209
  /** A code of the gate of a table of calorie needs. */
158
210
  export type NeedsCode = (typeof NEEDS_CODES)[number];
159
211
  /** A finding of the gate of a table of calorie needs: a finding of the gate of the sources, or a finding of a row. */
160
- export type NeedsFinding = Finding<NeedsCode | FindingCode, "source" | "unit" | "row" | "change">;
212
+ export type NeedsFinding = Finding<NeedsCode | FindingCode, "source" | "unit" | "row" | "change" | "chain">;
161
213
  /**
162
214
  * This function gives each finding of a table of calorie needs. A list with no error tells that the gate passes.
163
215
  *
@@ -172,6 +224,21 @@ export type NeedsFinding = Finding<NeedsCode | FindingCode, "source" | "unit" |
172
224
  * @param options - The options of the gate of the sources, for example the date of the gate
173
225
  */
174
226
  export declare function checkCalorieTable(table: CalorieTable, options?: GateOptions): NeedsFinding[];
227
+ /**
228
+ * This function gives each finding of a chain of tables. First come the findings of `checkCalorieTable` for each table,
229
+ * in the order of the chain. Then come the findings of the cover. For each sex, the rows of all the tables cover each month from 0 to an
230
+ * open last row (`needs-gap`, record `chain`). A row of a later table can overlap a row of an earlier table: the earlier
231
+ * table gives the need. Two tables of the chain with the same `id` give `needs-id`.
232
+ *
233
+ * The limit of the first match: when an earlier table loses a row at its start, a later table can give those months.
234
+ * Then the gate gives no finding. A caller that needs each month from one table tests the `id` of the table of each month.
235
+ *
236
+ * A list with no error tells that the gate passes. The function is pure.
237
+ *
238
+ * @param tables - One table, or tables in order
239
+ * @param options - The options of the gate of the sources, for example the date of the gate
240
+ */
241
+ export declare function checkCalorieChain(tables: CalorieTables, options?: GateOptions): NeedsFinding[];
175
242
  /** This function tells if a list of findings has an error. */
176
243
  export declare function hasNeedsError(findings: readonly NeedsFinding[]): boolean;
177
244
  /** The code of the need of the food draw: food energy, in `kcal` for each day. */
@@ -288,7 +355,14 @@ export interface HouseholdFragment {
288
355
  readonly draws: readonly FragmentDraw[];
289
356
  readonly direct: readonly FragmentDirectUse[];
290
357
  }
291
- /** The action for the persons with no row in the table. The only action is `leave-out`. */
358
+ /** The age in months below which a person record must have a `feeding`: 12, the first month of the guidelines. */
359
+ export declare const INFANT_MONTHS = 12;
360
+ /**
361
+ * The age in months from which an infant cannot have `feeding: "breast-milk"`: 6.
362
+ * From 6 months, the infant table gives more than the change of a stage of lactation, so a part of the need is in no draw. Give `food` from this age.
363
+ */
364
+ export declare const BREAST_MILK_MONTHS = 6;
365
+ /** The action for the persons that the draw cannot serve: no row in the table, or an infant on formula. The only action is `leave-out`. */
292
366
  export type NoRowAction = "leave-out";
293
367
  /** The inputs of the household fragment. */
294
368
  export interface HouseholdFragmentInput {
@@ -308,12 +382,12 @@ export interface HouseholdFragmentInput {
308
382
  readonly level: string;
309
383
  /** The levels of the fragment. The default is no levels: a different fragment of the stack gives them. */
310
384
  readonly levels?: readonly string[] | undefined;
311
- /** The table of calorie needs. The default is `DGA_CALORIES`. */
312
- readonly table?: CalorieTable | undefined;
385
+ /** The table of calorie needs, or tables in order. The default is `CALORIE_CHAIN`, which gives a row for each age. */
386
+ readonly table?: CalorieTables | undefined;
313
387
  /** The start of the `id` of each store. The default is `buy`. */
314
388
  readonly prefix?: string | undefined;
315
389
  /**
316
- * The action for the persons with no row in the table. Without it, a person with no row gives no layer.
390
+ * The action for the persons with no row in the table, and for the infants on formula. Without it, such a person gives no layer.
317
391
  * With `leave-out`, the draw has no need of those persons, and the result lists them.
318
392
  */
319
393
  readonly noRow?: NoRowAction | undefined;
@@ -344,8 +418,15 @@ export interface HouseholdFragmentRead extends HouseholdStoresResult {
344
418
  readonly need: CalorieNeedTotal;
345
419
  /** This field is true: the draw has a read for each of its users. */
346
420
  readonly needRead: true;
347
- /** The persons with no row that the option `leave-out` left out of the draw. With no option, the list is empty. */
421
+ /** The persons with no row, and the infants on formula, that the option `leave-out` left out of the draw. With no option, the list is empty. */
348
422
  readonly leftOut: readonly Person[];
423
+ /** The infants on formula. The option `leave-out` left them out of the draw, so `leftOut` also lists them. */
424
+ readonly formula: readonly Person[];
425
+ /**
426
+ * The infants on breast milk only. Each has a line with a read in `need`, and no part of the draw.
427
+ * The stage of lactation of a person of the draw holds that energy.
428
+ */
429
+ readonly breastMilk: readonly Person[];
349
430
  }
350
431
  /** No household fragment: the draw has no read. A low rate gives too many days, so the function gives no layer. */
351
432
  export interface HouseholdFragmentNoRead extends HouseholdStoresResult {
@@ -355,6 +436,10 @@ export interface HouseholdFragmentNoRead extends HouseholdStoresResult {
355
436
  readonly needRead: false;
356
437
  /** The persons with no row in the table. */
357
438
  readonly noRow: readonly Person[];
439
+ /** The infants on formula. The fragment has no draw of formula. */
440
+ readonly formula: readonly Person[];
441
+ /** The infants on breast milk only. */
442
+ readonly breastMilk: readonly Person[];
358
443
  /** The reason for no layer. */
359
444
  readonly why: string;
360
445
  }
@@ -370,14 +455,27 @@ export type HouseholdFragmentResult = HouseholdFragmentRead | HouseholdFragmentN
370
455
  * - The supply part of the draw is `supply`. Its default is the part of `NEED_SUPPLIES` for `food.energy`.
371
456
  * - The fragment has no converter. A caller adds converters for the dry food, with the water and the fuel of each run.
372
457
  *
373
- * A person with no row in the table gives no layer, because a low rate gives too many days.
458
+ * A person with no row in the tables gives no layer, because a low rate gives too many days. The default tables give a row for each age.
374
459
  * The option `noRow: "leave-out"` leaves those persons out of the draw. A draw of 0 kcal gives no layer.
460
+ *
461
+ * Each person record below `INFANT_MONTHS` must have a `feeding`. It has no default.
462
+ *
463
+ * - `food`: the need of the infant is in the draw of food energy.
464
+ * - `breast-milk`: the infant has a line, and no part of the draw. It is only for an infant below `BREAST_MILK_MONTHS`.
465
+ * A person of the household must have a stage of lactation. Each infant on breast milk needs one person of the draw with a stage of lactation.
466
+ * When the infants are more, the function gives no layer: the change of a stage is the milk of one infant.
467
+ * - `formula`: the fragment has no draw of formula, so the infant gives no layer, as a person with no row. The option `leave-out` also applies.
468
+ * It is only for an infant below `INFANT_MONTHS`.
469
+ *
375
470
  * The function is pure.
376
471
  *
377
472
  * @param input - The persons, the activity level, the catalog and the buy list, the supply part and the level of the draw
378
473
  * @returns The fragment or a no read of the draw, with the energy of the list and the gifts with no read
379
474
  * @throws RangeError for the errors of `calorieNeed`, `giftsOf` and `buyListEnergy`, except a household with no person
380
475
  * @throws RangeError when the catalog has no resource in `kcal` for a food use
476
+ * @throws RangeError when a record below `INFANT_MONTHS` has no `feeding`, or when a `feeding` is not a way of `INFANT_FEEDINGS`
477
+ * @throws RangeError for `breast-milk` from `BREAST_MILK_MONTHS`, and for `formula` from `INFANT_MONTHS`
478
+ * @throws RangeError when an infant drinks only breast milk and no person of the household has a stage of lactation
381
479
  */
382
480
  export declare function householdFragment(input: HouseholdFragmentInput): HouseholdFragmentResult;
383
481
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/calorie.ts","../src/data.ts","../src/check.ts","../src/uses.ts","../src/household.ts"],"mappings":";;;;qBAQa;;YAGD,wBAAwB;;qBAGvB;;YAGD,qBAAqB;;;;;YAMrB;WAAyB,QAAQ,SAAS,OAAO,eAAe;WAAqB;;WAA4B,MAAM;WAAmB;;;iBAGrI;WACN,KAAK;;WAEL;;WAEA;;WAEA;WACA,MAAM;;;;;;iBAOA;;WAEN;;WAEA;;WAEA,KAAK;;WAEL,QAAQ;;WAER;;;iBAIM;;WAEN;WACA;WACA,QAAQ;;WAER;;WAEA,eAAe;;WAEf,mBAAmB;;;iBAIb;WACN,KAAK;;WAEL;WACA;;WAEA,QAAQ;;WAER;;;YAIC;WACG,QAAQ;WAAiB;WAAqB,OAAO;WAAwB;WAAsB;WAAqC,MAAM;;WAC9I,QAAQ;WAAiB;WAAsB;;;iBAG7C;;WAEN,gBAAgB;;WAEhB;;WAEA,MAAM;;WAEN;;;wBASK,gBAAgB,iBAAiB,SAAS;;;;;;;;wBAW1C,WAAW,OAAO,cAAc,KAAK,YAAY,oBAAoB;;;;;;;;wBAWrE,cAAc,OAAO,cAAc,KAAK,YAAY,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;wBA0BpE,YAAY,OAAO,cAAc,kBAAkB,UAAU,OAAO,eAAe,eAAe;;qBCzIrG,YAAY;;qBAkBZ,cAAc;;qBAqFd,yBAAyB;;;;;;;;;;;;qBCpGzB;;YAGD,oBAAoB;;YAGpB,eAAe,QAAQ,YAAY;;;;;;;;;;;;;;wBA4B/B,kBAAkB,OAAO,cAAc,UAAU,cAAc;;wBA2D/D,cAAc,mBAAmB;;qBCtGpC;;qBAGA;;qBAGA;;qBAGA;;iBAGI;WACN;WACA;WACA;;;;;;;qBAQE;WAA0B;WAA0C;;;;;;;;;;qBAapE,sBAAsB;;;;;;;;;;;qBAetB;;YAUD,mBAAmB;;;;;YAMnB,cAAc,QAAQ;;iBAajB;WACN;WACA;;;iBAIM;WACN;;;iBAIM;;WAEN,gBAAgB;;WAEhB,gBAAgB;;;;;;;;;;;;;;;;;;wBAmBX,WACd,SAAS,eACT,eAAe,qBACf,UAAU,SAAS,yBACnB,YAAY,iBACX;;iBCpHc;WACN;WACA;;;iBAIM;WACN;WACA;WACA;;;iBAIM;WACN;WACA;;WAEA;;WAEA;WACA;;;iBAIM;;WAEN;WACA;WACA,oBAAoB;WACpB,iBAAiB;WACjB,gBAAgB;WAChB,iBAAiB;;;YAIhB;;iBAGK;;WAEN,kBAAkB;;WAElB,UAAU;;WAEV,SAAS;;WAET,OAAO,SAAS;;WAEhB;;WAEA,gBAAgB;;WAEhB;;WAEA;;WAEA,QAAQ;;WAER;;;;;WAKA,QAAQ;;;iBAIF;WACN;WACA;WACA;;;iBAIM;;WAEN,QAAQ;;WAER,kBAAkB;;WAElB;;;iBAIM,8BAA8B;WACpC,OAAO;;;;;;WAMP,MAAM;;WAEN;;WAEA,kBAAkB;;;iBAIZ,gCAAgC;WACtC;;WAEA,MAAM;WACN;;WAEA,gBAAgB;;WAEhB;;;YAIC,0BAA0B,wBAAwB;;;;;;;;;;;;;;;;;;;;wBA8C9C,kBAAkB,OAAO,yBAAyB"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/calorie.ts","../src/data.ts","../src/check.ts","../src/uses.ts","../src/household.ts"],"mappings":";;;;qBAQa;;YAGD,wBAAwB;;qBAGvB;;YAGD,qBAAqB;;;;;YAMrB;WAAyB,QAAQ,SAAS,OAAO,eAAe;WAAqB;;WAA4B,MAAM;WAAmB;;;iBAGrI;WACN,KA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