1.0.0 • Published 6 years ago

variation v1.0.0

Weekly downloads
2
License
MIT
Repository
-
Last release
6 years ago

Variation 🎲

Build Status

Utility functions to add variations to any kind of output.

Usage Example

const { random, chance, randomItem } = require('variation');

console.log(
  random('hello', 'ciao', 'hola', 'salut'),
  chance(0.5, 'beautiful'),
  randomItem(['world', 'people'])
);

API

Table of Contents

random

Returns a random argument.

Parameters

  • args ...any

randomItem

Returns a random item from the given array.

Parameters

chance

Returns value with the given probability, false otherwise.

Parameters

  • probability number (optional, default 0.5)
  • value any (optional, default true)

License

MIT