You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ass/generators/gfycat.js

20 lines
643 B

const fs = require('fs-extra');
const adjectiveList = fs.readFileSync("./gfycat/adjectives.txt", "utf-8").split('\n');
const animalsList = fs.readFileSync("./gfycat/animals.txt", "utf-8").split('\n');
function genString(adjCount) {
let adjectivesString = "";
for (i = 0; i < adjCount; i++) adjectivesString += genAdjective();
return adjectivesString + genAnimal();
};
function genAnimal() {
return animalsList[Math.floor(Math.random()*animalsList.length)];
}
function genAdjective() {
return adjectiveList[Math.floor(Math.random()*adjectiveList.length)] + "-";
}
module.exports = (adjectives) => genString(adjectives);