Skip to the content.

random_item

codecov deno doc

Get a random item from an array

Usage

The API is the same on all this platforms βœ”οΈ

Deno πŸ¦•

import {
  randomItem,
  randomMultipleItems,
} from "https://deno.land/x/random_item/mod.ts";

randomItem(["🐴", "πŸ¦„", "🌈"]); //=> 'πŸ¦„'

randomMultipleItems(["🐴", "πŸ¦„", "🌈"], 2); //=> ['🌈', 'πŸ¦„']

randomItem([...new Set(["🐴", "πŸ¦„", "🌈"])]); //=> '🌈'

Node.js πŸ¦–

import { randomItem, randomMultipleItems } from "@ultirequiem/random-item";

Browser 🌐

You can use any CDN πŸ”₯

Eg πŸ‘‰ ESM ↔️ SkyPack πŸ†š Script Tag ↔️ JSDelivr

Documentation

Is hosted on Deno Doc πŸ“š

CLI

Install

deno install https://deno.land/x/random_item/random_item.ts
npm install -g @ultirequiem/random-item

Usage

random_item --help

A binary for multiple platforms is provided too!

Video Showcase

Support

Open an Issue, I will check it a soon as possible πŸ‘€

If you want to hurry me up a bit send me a tweet πŸ˜†

Consider supporting me on Patreon if you like my work πŸ™

Don’t forget to star the repo ⭐

Versioning

We use Semantic Versioning. For the versions available, see the tags 🏷️

Authors

Eliaz Bobadilla (a.k.a UltiRequiem) - Creator and Maintainer πŸ’ͺ

See also the full list of contributors who participated in this project ✨

Licence

Licensed under the MIT License πŸ“„