pro-con

1.0.3 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i pro-con

Weekly Downloads

1

Version

1.0.3

License

MIT

Last publish

Collaborators

  • isaachvazquez