randomlyjs

1.0.2 • Public • Published

randomly

Make random decisions

Install

$ npm install randomlyjs

Usage

const randomly = require('randomlyjs')

randomly('foo', 'bar')
//50% of the time, returns 'foo'; 50% of the time, returns 'bar'

randomly(1, 3, 5, 7, 8)
//equal probability of returning 1, 3, 5, 7, or 8


//works with callbacks
const buggify = function(fn) {
  return function() {
    return randomly(fn(...arguments), (() => new Error('Unexpected Token:😏'))())
  }
}

Readme

Keywords

Package Sidebar

Install

npm i randomlyjs

Weekly Downloads

2

Version

1.0.2

License

MIT

Unpacked Size

2.08 kB

Total Files

5

Last publish

Collaborators

  • clambodile