pro-con
v1.0.3
Published
Help make a decision using a weighted Pros and Cons.
Downloads
2
Readme
pro-con
Help make a decision using weighted Pros and Cons.
Install
npm
npm install pro-con --save
Usage
Create two lists of pros and cons and asign weights to those pros/cons.
var should_i_buy_this_donut = require('pro-con');
var pros = [
{
pro: 'Its a donut',
weight: 5
},
{
pro: 'It will taste good',
weight: 3
},
{
pro: 'Its a donut',
weight: 5
}
];
var cons = [
{
con: 'It cost money',
weight: 4
},
{
con: 'Its not healthy for me',
weight: 4
},
{
con: 'Sticky hands',
weight: 4
}
];
console.log(should_i_buy_this_donut(pros, cons));
It will return an object with the results containing 2 values:
decision
<String>
yes or nodecision_margin
<Number>
Difference between the pros & cons
// example
{
decision: 'yes',
decision_margin: 1
}
Test
npm install
npm test