variation

1.0.0 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i variation

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

3.32 kB

Total Files

6

Last publish

Collaborators

  • fgnass