• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

zgoda / curingtables / 13927600490

18 Mar 2025 03:49PM UTC coverage: 46.491% (-3.5%) from 50.0%
13927600490

Pull #381

github

web-flow
Merge 78520a1db into fe6d0d073
Pull Request #381: Bump @picocss/pico from 2.0.6 to 2.1.1

14 of 25 branches covered (56.0%)

Branch coverage included in aggregate %.

39 of 89 relevant lines covered (43.82%)

2.0 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

90.48
/src/tables.js
1
/**
2
 * Tables for wet curing meats.
3
 *
4
 * There are 2 general types, "classic" which are according to industry norms observed
5
 * before 2004 and "modern" which are in common use these days. Earlier used more salt
6
 * to allow for for lower process temperatures but now the salt content is considered
7
 * much too high and nutrition boffins rather opt for higher process temperatures in
8
 * exchange for lower salt content.
9
 *
10
 * Additionally, each of these types provides low-to-high range of salt content.
11
 *
12
 * When curing meats for home consumption it's generally advisable to start with "low
13
 * modern" table and go up from there, not the other way around.
14
 *
15
 * "Classic" norms required injecting part of brine in the meat when chunk weight
16
 * exceeded 0.8 kg, now the threshold is lower and common advice is to inject always
17
 * if chunk size exceeds 1 cm per 1 day in brine in all directions. In general weaker
18
 * brines require more injection.
19
 *
20
 * Short curing process requires massaging meat in 6-12 hours intervals.
21
 *
22
 * Water to meat ratio: 0.4
23
 * Injection size ratio: 0.06 (60 ml)
24
 * Short curing process: up to (and including) 3 days
25
 */
26

27
export const CuringDays = Object.freeze({
1✔
28
  ONE: 1,
29
  TWO: 2,
30
  THREE: 3,
31
  FOUR: 4,
32
  FIVE: 5,
33
  SIX: 6,
34
  SEVEN: 7,
35
  EIGHT_TO_TEN: 8,
36
  ELEVEN_TO_THIRTEEN: 11,
37
});
38

39
const DAYS = [
1✔
40
  CuringDays.ONE,
41
  CuringDays.TWO,
42
  CuringDays.THREE,
43
  CuringDays.FOUR,
44
  CuringDays.FIVE,
45
  CuringDays.SIX,
46
  CuringDays.SEVEN,
47
];
48

49
export const TableType = Object.freeze({
1✔
50
  CLASSIC: 'classic',
51
  MODERN: 'modern',
52
});
53

54
export const WATER_RATIO = 0.4; // kgms or litres
1✔
55
export const INJECT_SIZE = 0.06; // litres
1✔
56
export const MASSAGE_THRESHOLD = 4; // massage required if curing period shorter
1✔
57

58
const SALT_CLASSIC_HIGH = new Map([
1✔
59
  [CuringDays.ONE, 80],
60
  [CuringDays.TWO, 74],
61
  [CuringDays.THREE, 68],
62
  [CuringDays.FOUR, 62],
63
  [CuringDays.FIVE, 58],
64
  [CuringDays.SIX, 54],
65
  [CuringDays.SEVEN, 50],
66
  [CuringDays.EIGHT_TO_TEN, 46],
67
  [CuringDays.ELEVEN_TO_THIRTEEN, 42],
68
]);
69

70
const INJECT_RATE_CLASSIC_HIGH = new Map([
1✔
71
  [CuringDays.ONE, 4],
72
  [CuringDays.TWO, 4],
73
  [CuringDays.THREE, 3],
74
  [CuringDays.FOUR, 1.5],
75
  [CuringDays.FIVE, 1],
76
  [CuringDays.SIX, 1],
77
  [CuringDays.SEVEN, 1],
78
  [CuringDays.EIGHT_TO_TEN, 1],
79
  [CuringDays.ELEVEN_TO_THIRTEEN, 1],
80
]);
81

82
const SALT_CLASSIC_LOW = new Map([
1✔
83
  [CuringDays.ONE, 76],
84
  [CuringDays.TWO, 70],
85
  [CuringDays.THREE, 64],
86
  [CuringDays.FOUR, 60],
87
  [CuringDays.FIVE, 56],
88
  [CuringDays.SIX, 52],
89
  [CuringDays.SEVEN, 48],
90
  [CuringDays.EIGHT_TO_TEN, 44],
91
  [CuringDays.ELEVEN_TO_THIRTEEN, 40],
92
]);
93

94
const INJECT_RATE_CLASSIC_LOW = new Map([
1✔
95
  [CuringDays.ONE, 5],
96
  [CuringDays.TWO, 4],
97
  [CuringDays.THREE, 3],
98
  [CuringDays.FOUR, 2],
99
  [CuringDays.FIVE, 1.5],
100
  [CuringDays.SIX, 1.4],
101
  [CuringDays.SEVEN, 1.3],
102
  [CuringDays.EIGHT_TO_TEN, 1.2],
103
  [CuringDays.ELEVEN_TO_THIRTEEN, 1],
104
]);
105

106
const SALT_MODERN_HIGH = new Map([
1✔
107
  [CuringDays.ONE, 76],
108
  [CuringDays.TWO, 72],
109
  [CuringDays.THREE, 64],
110
  [CuringDays.FOUR, 52],
111
  [CuringDays.FIVE, 48],
112
  [CuringDays.SIX, 46],
113
  [CuringDays.SEVEN, 42],
114
  [CuringDays.EIGHT_TO_TEN, 38],
115
  [CuringDays.ELEVEN_TO_THIRTEEN, 34],
116
]);
117

118
const INJECT_RATE_MODERN_HIGH = new Map([
1✔
119
  [CuringDays.ONE, 4],
120
  [CuringDays.TWO, 4],
121
  [CuringDays.THREE, 2],
122
  [CuringDays.FOUR, 1.5],
123
  [CuringDays.FIVE, 1],
124
  [CuringDays.SIX, 1],
125
  [CuringDays.SEVEN, 1],
126
  [CuringDays.EIGHT_TO_TEN, 1],
127
  [CuringDays.ELEVEN_TO_THIRTEEN, 1],
128
]);
129

130
const SALT_MODERN_LOW = new Map([
1✔
131
  [CuringDays.ONE, 72],
132
  [CuringDays.TWO, 68],
133
  [CuringDays.THREE, 60],
134
  [CuringDays.FOUR, 50],
135
  [CuringDays.FIVE, 46],
136
  [CuringDays.SIX, 44],
137
  [CuringDays.SEVEN, 40],
138
  [CuringDays.EIGHT_TO_TEN, 36],
139
  [CuringDays.ELEVEN_TO_THIRTEEN, 32],
140
]);
141

142
const INJECT_RATE_MODERN_LOW = new Map([
1✔
143
  [CuringDays.ONE, 5],
144
  [CuringDays.TWO, 4],
145
  [CuringDays.THREE, 3],
146
  [CuringDays.FOUR, 2],
147
  [CuringDays.FIVE, 1.5],
148
  [CuringDays.SIX, 1.4],
149
  [CuringDays.SEVEN, 1.3],
150
  [CuringDays.EIGHT_TO_TEN, 1.2],
151
  [CuringDays.ELEVEN_TO_THIRTEEN, 1],
152
]);
153

154
const TYPE_TO_TABLE = new Map([
1✔
155
  [TableType.CLASSIC, { low: SALT_CLASSIC_LOW, high: SALT_CLASSIC_HIGH }],
156
  [TableType.MODERN, { low: SALT_MODERN_LOW, high: SALT_MODERN_HIGH }],
157
]);
158

159
const TYPE_TO_INJECTION = new Map([
1✔
160
  [TableType.CLASSIC, { low: INJECT_RATE_CLASSIC_LOW, high: INJECT_RATE_CLASSIC_HIGH }],
161
  [TableType.MODERN, { low: INJECT_RATE_MODERN_LOW, high: INJECT_RATE_MODERN_HIGH }],
162
]);
163

164
/**
165
 * @param {string} table
166
 * @param {number} days
167
 * @returns {import('..').Rate}
168
 */
169
export function getSaltRate(table, days) {
170
  const { low, high } = TYPE_TO_TABLE.get(table);
8✔
171
  /** @type {number} */
172
  let curingDays;
173
  if (days >= 8 && days < 11) {
8!
174
    curingDays = CuringDays.EIGHT_TO_TEN;
×
175
  } else if (days > 10) {
8✔
176
    curingDays = CuringDays.ELEVEN_TO_THIRTEEN;
3✔
177
  } else {
178
    curingDays = DAYS[days - 1];
5✔
179
  }
180
  return { low: low.get(curingDays), high: high.get(curingDays) };
8✔
181
}
182

183
/**
184
 * @param {string} table
185
 * @param {number} days
186
 * @returns {import('..').Rate}
187
 */
188
export function getInjectionRate(table, days) {
189
  const { low, high } = TYPE_TO_INJECTION.get(table);
8✔
190
  /** @type {number} */
191
  let curingDays;
192
  if (days >= 8 && days < 11) {
8!
193
    curingDays = CuringDays.EIGHT_TO_TEN;
×
194
  } else if (days > 10) {
8✔
195
    curingDays = CuringDays.ELEVEN_TO_THIRTEEN;
3✔
196
  } else {
197
    curingDays = DAYS[days - 1];
5✔
198
  }
199
  return { low: low.get(curingDays), high: high.get(curingDays) };
8✔
200
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc