Skip to content

Commit 8654bec

Browse files
authored
Merge pull request #23 from manuporto/master
Convert "pecks" to litres
2 parents 114316e + 82fd523 commit 8654bec

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

src/conversion_helper.js

+8
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,14 @@ const unitLookupList = [
344344
"conversionFunction" : (i) => volumeMap(i * 3.78541),
345345
"ignoredUnits" : ["imperial"].concat(metricVolumeUnits)
346346
},
347+
{
348+
"imperialUnits" : [/pecks?/, /pks?/],
349+
"standardInputUnit" : " pk (US)",
350+
"isInvalidInput" : isZeroOrNegative,
351+
"isWeaklyInvalidInput" : isHyperbole,
352+
"conversionFunction" : (i) => volumeMap(i * 8.80977),
353+
"ignoredUnits" : ["imperial"].concat(metricVolumeUnits)
354+
},
347355
{
348356
"imperialUnits" : [/(?:°|degrees?) ?(?:f|fahrenheit)/, /fahrenheit/],
349357
"weakImperialUnits" : ["f", "degrees?"],

test/converter-test.js

+19
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,25 @@ describe('Converter', () => {
276276
});
277277
});
278278

279+
context('pecks', () => {
280+
it('should convert', () => {
281+
testConvert(
282+
[
283+
"1 peck",
284+
"13 pecks",
285+
"5 pk",
286+
"5pk",
287+
],
288+
{
289+
"1 pk (US)" : "9 L",
290+
"13 pk (US)": "115 L",
291+
"5 pk (US)" : "44 L",
292+
"5 pk (US)" : "44 L"
293+
}
294+
);
295+
});
296+
});
297+
279298
context('°F', () => {
280299
it('should convert', () => {
281300
testConvert(

0 commit comments

Comments
 (0)