Socket
Socket
Sign inDemoInstall

hs-mana-curve

Package Overview
Dependencies
0
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    hs-mana-curve

A simple module that generates a text-based mana curve graph based on an array of card costs.


Version published
Weekly downloads
0
Maintainers
1
Created
Weekly downloads
 

Readme

Source

hs-mana-curve

A simple module that generates a text-based mana curve graph based on an array of card costs.

Instalation

npm i hs-mana-curve --save

Parameters

parameter (default value): description
  • costs ([]): An array of integers that represent the amount of cards with a cost equal to their index.
  • max (8): The maximum amount of cards that will be shown in the curve before it gets capped out.
  • mode ("expanded"): Either expanded or compressed. Determines how to curve will look.
  • showAmt (false): Whether or not to show the amount of cards for each mana cost at the top of each bar.

How to use

var manaCurve = require("hs-mana-curve");

var cardCosts = [0, 3, 6, 0, 6, 4, 3, 4, 2, 0, 2];
//card costs taken from https://www.hearthpwn.com/decks/1082636-spiteful-lady-in-white
//array indexes are based on mana cost so like array[cost] = amount of cards with that cost

var curveCap = 8;
//how high the module counts cards with a certain mana cost before they get capped off

var curve = manaCurve(cardCosts, curveCap, "compressed", false);

//output below

Different outputs

Expanded

              █ 
              █ 
    █   █     █ 
    █   █     █ 
    █   █ █   █ 
  █ █   █ █ █ █ 
  █ █   █ █ █ █ 
_ █ █ _ █ █ █ █ 
0 1 2 3 4 5 6 7+

Compressed

              █ 
    █   █     █ 
  ▄ █   █ █ ▄ █ 
_ █ █ _ █ █ █ █ 
0 1 2 3 4 5 6 7+

Expanded w/ showAmt

0 3 6 0 6 4 3 8
- - - - - - - -
              █ 
              █ 
    █   █     █ 
    █   █     █ 
    █   █ █   █ 
  █ █   █ █ █ █ 
  █ █   █ █ █ █ 
_ █ █ _ █ █ █ █ 
0 1 2 3 4 5 6 7+

Compressed w/ showAmt

0 3 6 0 6 4 3 8
- - - - - - - -
              █ 
    █   █     █ 
  ▄ █   █ █ ▄ █ 
_ █ █ _ █ █ █ █ 
0 1 2 3 4 5 6 7+

Keywords

FAQs

Last updated on 20 Apr 2018

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc