1.2.1 • Published 4 years ago

probability-to-friendly-string v1.2.1

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

Package on npm: probability-to-friendly-string. Requires ES6, can be used with or without node.js.

Usage:

// This line isn't needed if you're not using through npm
import FriendlyProbability from 'probability-to-friendly-string';
let friendly = FriendlyProbability.fromProbability(.723);

friendly is a class of type FriendlyProbability that has properties

  • friendlyString: a string representing the probability (in this case "5 in 7")
  • friendlyDescription: a qualitative description of the probability ("Still possible", "Flip a coin", "Good chance", etc.)
  • numerator: the numerator of the probability (in this case 5)
  • denominator: the denominator of the probability (in this case 7)

Note that passing a value less than 0 or greater than 1 to FriendlyProbability.fromProbability() will throw an Error.

1.2.1

4 years ago

1.2.0

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.0

6 years ago