random-fruits

0.2.1 • Public • Published

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.

Installation

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
randomFruit.roll();
 
randomFruit.rollThree();

you can use import syntax either :

import { roll, rollThree } from 'random-fruits';
 
roll(); // 🍍
 
rollThree(); // 🥭,🍓,🍌

Tech stack

Notes

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.

Contributing

contributers welcomed here! 😀🙌 you can easily fork this project , add your changes and create pull request .

Roadmap

  • 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

License

developed and maintained under MIT license © Benthic

Package Sidebar

Install

npm i random-fruits

Weekly Downloads

5

Version

0.2.1

License

MIT

Unpacked Size

55.3 kB

Total Files

6

Last publish

Collaborators

  • clrcode