1.0.3 • Published 7 years ago

pro-con v1.0.3

Weekly downloads
1
License
MIT
Repository
-
Last release
7 years ago

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:

  1. decision <String> yes or no
  2. decision_margin <Number> Difference between the pros & cons
// example
{
	decision: 'yes',
	decision_margin: 1 
}

Test

npm install
npm test

License

MIT

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago