Github Random Emoji Generator

DAY 7 👾

I’m back 💙

Today I created Github Random Emoji Generator Package. I’ve created this package to insert random Emoji’s that are supported on Github in my each commit message.

The npm package can be found here.

RANDOM EMOJI.JSON FILE

It gives all the Emoji’s supported by Github. It uses a Github Emoji’s JSON file. The file can be found here.

Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
var jsonContent = require("./random.json");
var arr = [];
for(var keys in jsonContent) {
arr.push(keys);
}
var n = Math.floor(Math.random() * arr.length);
var obj = {
name: arr[n],
emoji: jsonContent[arr[n]]
};
console.log(obj);

Install

1
$ npm install --save random-github-emoji

Usage

1
2
3
4
5
6
7
const random = require('random-github-emoji');
random();
//=> { name: 'crocodile', emoji: '🐊' }
random();
//=> { name: 'hammer_and_pick', emoji: '⚒' }

Final Application Code Here

Till the next time 👻