random-array-item
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

Random Array Item

Build Downloads this Week Bundle Size Version

Numify

🦄 Simple utility to fetch a random item from an array.

📦 Requirements

Node.js 12.x LTS or 14.x (or Higher) LTS

Installation

Install the NPM Package with the below command:

npm install random-array-item --save

(or)

Install with Yarn:

yarn add random-array-item

🖊️ Usage

Import the module in your project:

// Commonjs Import
var { randomArrayItem } = require("random-array-item");

// or ES6 import
import { randomArrayItem } from "random-array-item";

💡 Example

Pass the Array to the function

import { randomArrayItem } from "random-array-item";

let array = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"];
let randomItem = randomArrayItem(array);
console.log(randomItem);

☑️ Example Output

7

🛡️ LICENSE

  • MIT

💚 Message

I hope you find this useful. If you have any questions, please create an issue.


💰 Help me with your donation

Buy Me A Coffee

Package Sidebar

Install

npm i random-array-item

Weekly Downloads

4

Version

0.0.2

License

MIT

Unpacked Size

3.72 kB

Total Files

5

Last publish

Collaborators

  • mcnaveen