Skip to content

Commit

Permalink
Update 2.2.0 - Added random emoji creation 💥
Browse files Browse the repository at this point in the history
  • Loading branch information
xxczaki authored Feb 11, 2018
1 parent 5a6d37b commit d7d2645
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
24 changes: 12 additions & 12 deletions lib/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ const opn = require('opn');
const inquirer = require('inquirer');

// Little helper
const getRandomIndex = (length) => {
return Math.floor(Math.random()*length);
}
const getRandomIndex = length => {
return Math.floor(Math.random() * length);
};

// Create emoji!
module.exports.create = () => {
Expand Down Expand Up @@ -110,12 +110,12 @@ module.exports.random = () => {
fs.readFileSync(`${__dirname}/parts/${fileName}.txt`, 'utf8').split('\n')
);
// Combine random parts
const leftarmIndex = getRandomIndex([...parts[1], ...parts[0]].length)
const rightarmIndex = getRandomIndex([...parts[8], ...parts[0]].length)
const bodyIndex = getRandomIndex([...parts[3], ...parts[2]].length)
const cheeksIndex = getRandomIndex(parts[4].length)
const eyesIndex = getRandomIndex(parts[5].length)
const mouthIndex = getRandomIndex(parts[6].length)
const leftarmIndex = getRandomIndex([...parts[1], ...parts[0]].length);
const rightarmIndex = getRandomIndex([...parts[8], ...parts[0]].length);
const bodyIndex = getRandomIndex([...parts[3], ...parts[2]].length);
const cheeksIndex = getRandomIndex(parts[4].length);
const eyesIndex = getRandomIndex(parts[5].length);
const mouthIndex = getRandomIndex(parts[6].length);
const selectedParts = {
leftArm: [...parts[1], ...parts[0]][leftarmIndex],
rightArm: [...parts[8], ...parts[0]][rightarmIndex],
Expand All @@ -125,8 +125,8 @@ module.exports.random = () => {
rightCheek: parts[4][cheeksIndex],
leftEye: parts[5][eyesIndex],
rightEye: parts[5][eyesIndex],
noseMouth: parts[6][mouthIndex],
}
noseMouth: parts[6][mouthIndex]
};
// Show user generated emoji
const emoji = `${selectedParts.leftArm}${selectedParts.leftBody}${selectedParts.leftCheek}${selectedParts.leftEye}${selectedParts.noseMouth}${selectedParts.rightEye}${selectedParts.rightCheek}${selectedParts.rightBody}${selectedParts.rightArm}`;
console.log(chalk.cyan(`${chalk.green.bold('This is your emoticon:')}`, emoji));
Expand Down Expand Up @@ -157,7 +157,7 @@ module.exports.random = () => {
console.log(chalk.green.bold(`Emoticon saved in ${homeDir}!`));
}
});
}
};

// View saved emoji and copy it to clipboard!
module.exports.get = () => {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "oji",
"version": "2.1.1",
"version": "2.2.0",
"description": "(◕‿◕) Text Emoticon Maker",
"bin": {
"oji": "./bin/cli"
Expand Down

0 comments on commit d7d2645

Please sign in to comment.