generates random fruity strings

Usage no npm install needed!

<script type="module">
  import randomFruits from 'https://cdn.skypack.dev/random-fruits';


Random Fruits Generator🎲

Random Fruits is a simple javascript library that generates some random fruits and it could be used in both browser and nodejs enviroments.


install via node :

$ npm i random-fruits

# Or if you use Yarn
$ yarn add random-fruits

You can also use this library on the browser directly:

<!-- For development -->
<script src="https://unpkg.com/random-fruits/dist/random-fruits.umd.js"></script>

<!-- Minified version for production -->
<script src="https://unpkg.com/random-fruits/dist/random-fruits.umd.min.js"></script>

Quick Start

On Node.js:

const randomFruits = require('random-fruits');

randomFruits.roll(); // "πŸ‰"

randomFruits.rollThree(); // "πŸ‡,🍍,πŸ‹"

If you load the umd bundle on the browser, you can access the randomFruit function globally :

window.randomFruit.roll(); // "🍏"

// Or simply


you can use import syntax either :

import { roll, rollThree } from 'random-fruits';

roll(); // 🍍

rollThree(); // πŸ₯­,πŸ“,🍌

Tech stack


supported enviroments :

last 2 version
> 5%
not dead
maintained node versions

uses rollup for ES Modules bundling and babel for coverting es2015+ code to es5.

also uses node-resolve plugin to compile cjs code to es module compatible ones for tree-shaking purposes done automatically by rollup.

lodash can be used as peer dependency.


contributers welcomed here! πŸ˜€πŸ™Œ you can easily fork this project , add your changes and create pull request .


  • typescript support
  • tests
  • fruits slot machine
  • roll returns fruits as much as you want
  • dockerfiles
  • reduce project bundle size
  • UI component for react
  • create a blog post on DEV.to or Medium
  • animations

Helpful Links

wesbos - javascript modules bundling your javascript library with rollup


developed and maintained under MIT license Β© Benthic