To install the library all you have to do is:
$ npm install growth
If you don't have node installed checkout this guide.
After install the package, you can start using in the following way:
var growth = require('growth');
var measure = {
"gender": "male",
"dob": "2000/05/09",
"doa": "2000/10/12",
"weight": 4.80,
"height": 59.80,
"c_head": 38.90,
"c_upper_arm": 11.20,
"sk_triceps": 5.50,
"sk_subscapular": 4.60
};
function calculate(error, result) {
if (error) {
throw error;
}
console.log(result.result);
}
growth.measure(measure, calculate);
If you have a series of measurements, it's possible to process then in a batch:
var growth = require('growth');
var measures = [
{
"gender": "male",
"dob": "2000/05/09",
"doa": "2000/10/12",
"weight": 4.80,
"height": 59.80,
"c_head": 38.90,
"c_upper_arm": 11.20,
"sk_triceps": 5.50,
"sk_subscapular": 4.60
},
{
"gender": "male",
"dob": "2000/05/09",
"doa": "2000/12/12",
"weight": 5.50,
"height": 61.20,
"c_head": 40.30,
"c_upper_arm": 11.40,
"sk_triceps": 5.20,
"sk_subscapular": 4.40
}
];
function calculate(error, results) {
if (error) {
throw error;
}
results.forEach(function (result) {
console.log(result.result);
});
}
growth.batchMeasure(measures, calculate);
- Add license info
- Implement stream interface, something in the line of levelUp
- How about implement:
- Istanbul for code coverage and
- Complexity Report for code analysis
- Expose the
factory#db
interface contained inlib#lms
Copyright (c) 2013 Joao Paulo Dubas [email protected]
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.