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.
|
|
|
const fs = require('fs-extra');
|
|
|
|
const adjectives = fs.readFileSync('./generators/gfycat/adjectives.txt').toString().split('\n');
|
|
|
|
const animals = fs.readFileSync('./generators/gfycat/animals.txt').toString().split('\n');
|
|
|
|
const MIN_LENGTH = require('../setup').gfyIdSize;
|
|
|
|
|
|
|
|
function genString(count = MIN_LENGTH) {
|
|
|
|
let gfycat = '';
|
|
|
|
for (i = 0; i < (count < MIN_LENGTH ? MIN_LENGTH : count); i++)
|
|
|
|
gfycat += getWord(adjectives, '-');
|
|
|
|
return gfycat.concat(getWord(animals));
|
|
|
|
};
|
|
|
|
|
|
|
|
function getWord(list, delim = '') {
|
|
|
|
return list[Math.floor(Math.random() * list.length)].concat(delim);
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = ({ gfyLength }) => genString(gfyLength);
|