Get unlimited public & private packages + team-based management with npm Teams.Learn more »

bitterness

1.0.4 • Public • Published

Bitterness

Build Status

A basic library providing utility methods to calculate bitterness of a given recipe, in IBU measure unit, featuring Rager forumula, Tinseth formula or an average of the two, Garetz formula is also available. Measure system is defaulted at European decimal system, supports Imperial system too.

Installation

npm install bitterness
# for development purpose install (e.g. running tests) need mocha and chai 
npm install bitterness --dev

Usage

var bt = require('bitterness');
// ibu value with Rager formula
var rager = bt.rager(
        hopWeight, // grams of hop
        time, // time in minutes
        alphaAcids, // AA% in the form of % (e.g. 6% => 6)
        batchSize, // size of the batch in liters
        originalGravity); // OG in the form xxxx.xx (e.g. 1050.00)
// ibu value with Tinseth formula
var tinseth = bt.tinseth(
        hopWeight, // grams of hop
        time, // time in minutes
        alphaAcids, // AA% in the form of % (e.g. 6% => 6)
        batchSize, // size of the batch in liters
        originalGravity); // OG in the form xxxx.xx (e.g. 1050.00)
// ibu value using Garetz formula
var garetz = bt.garetz(
        hopWeight, // grams of hop
        time, // time in minutes
        alphaAcids, // AA% in the form of % (e.g. 6% => 6)
        batchSize, // size of the batch in liters
        originalGravity, // OG in the form xxxx.xx (e.g. 1050.00)
        final_volume // size of the volume post boil in liters
        height); // height in meters of the boiling batch
 

Practical example:

var bt = require('bitterness');
var rager = bt.rager;
// 93 grams, 90 minutes boil time, 6% alpha acids, 25 liters batch, 1050 og
var r = rager(93, 90, 6, 25, 1050);
var g = bt.garetz(93, 90, 6, 25, 1050); // using defaulted final volume = (batch size - 10%) and height = 0
 
console.log(r); // ~ 71 ibu
console.log(g); // ~ 49 ibu
 
bt.setMetricSystem(false); // set system to imperial
// 3.17 oz, 90 minutes, 6% alpha acids, 6.60 gallons, 1050 og
var r = rager(3.17, 90, 6, 6.60, 1050);
 

Test

npm test

Changelog

See the CHANGELOG file.

License

See the LICENSE-MIT file for license rights and limitations (MIT).

Install

npm i bitterness

DownloadsWeekly Downloads

31

Version

1.0.4

License

none

Last publish

Collaborators

  • avatar