Skip to content

zachowj/node-red-contrib-random-item

Repository files navigation

Release Version License

BuyMeCoffee

node-red-contrib-random-item

A Node-RED node that selects a random item from an array.

Install

Run the following command in your Node-RED user directory - typically ~/.node-red

npm i node-red-contrib-random-item

Usage

A node that selects a random item from an array.

Inputs

Input needs to be in a JSON formatted array.

Examples of inputs:

["first", "second", "third", "fourth"]
[1, 2, 3, 4, 5]
[
  { "name": "George Jetson", "role": "father" },
  { "name": "Jane Jetson", "role": "mother" },
  { "name": "Judy Jetson", "role": "daugter" },
  { "name": "Elroy Jetson", "role": "son" }
]

Outputs

Output will either be a single data type or an array of items if the Max # of items is greater than one.

Find Us

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details.