Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

pro-con

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pro-con

Help make a decision using a weighted Pros and Cons.

latest
npmnpm
Version
1.0.3
Version published
Maintainers
1
Created
Source

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 no
  • decision_margin <Number> Difference between the pros & cons
// example
{
	decision: 'yes',
	decision_margin: 1 
}

Test

npm install
npm test

License

MIT

FAQs

Package last updated on 09 Aug 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts