random-spinner

1.0.2 • Public • Published

Spinner to call a function from a list at random

Provide this function an array of callback functions and it will pick one of them at random and call it with no parameters.

If you need parameters, curry the function to call with the required parameters first, then send it to spinner

Example 1:

const { spinner } = require('random-spinner');
const a = () => console.log("this is a");
const b = () => console.log("this is b");
const c = () => console.log("this is c");

spinner([a, b, c]);

Example 2:

const { spinner } = require('random-spinner');
const a = (p1, p2) => () => console.log("this is a with two parameters");
const b = (p1) => () => console.log("this is b with one parameter");
const c = () => console.log("this is c");

spinner([a, b, c]);

Package Sidebar

Install

npm i random-spinner

Weekly Downloads

1

Version

1.0.2

License

ISC

Unpacked Size

2.96 kB

Total Files

4

Last publish

Collaborators

  • rogerjaffe