Scripts by JCofman

Generate fake data with faker.js

Here is a simple one to generate fake data with https://github.com/marak/Faker.js/ and save it to clipboard.

// Menu: Fake
// Description: generate fake data with faker.js
// Author: Jacob Cofman
// Twitter: @jcofman
const faker = await npm("faker");
function getMethodFakerData(method) {
return Object.keys(faker[method]);
}
const fakerMethods = [
"name",
"address",
"phone",
"internet",
"company",
"image",
"lorem",
"helpers",
"date",
"random",
"finance",
"hacker",
"system",
"commerce",
"database",
"animal",
"git",
"music",
"datatype",
];
const method = await arg("Select-Base-Method:", fakerMethods);
const fakerBaseMethods = getMethodFakerData(method);
const script = await arg("Select-Script:", fakerBaseMethods);
const result = await faker[method][script]();
copy(result);
await arg(result);
Discuss Post