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>
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(); // π₯,π,π
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
- random-emojis
wesbos - javascript modules bundling your javascript library with rollup
developed and maintained under MIT license Β© Benthic