super-fake v1.3.2
SuperFaker
SuperFaker is a Node.js library for generating fake data such as names, emails, phone numbers, etc.
Installation
You can install SuperFaker using npm:
npm install super-fake
const { SuperFaker } = require('superfaker'); const superFaker = new SuperFaker('EN');
Example: Generating a random object with unique values
const obj = superFaker.object.unique({ name: '', age: 0, phone: 1, firstName: '' }, 10);
console.log(obj);//=>{name:'alex',age:10,phone:(51)986899990,firstName:'joao'}
Example: Generating an array of random objects
const objArray = superFaker.object.array({ names: [''], total: [0] }, 3, 2);
console.log(objArray); //=>[{names:['alex','will','joao'],total:[1,10,22]},{names:['jim','marie','fellipe'],total:[11,20,42]}]
object.unique(template, count)
Generates an array of unique objects based on the provided template.
template: Object template with keys and initial values. count: Number of objects to generate. object.array(template, objectCount, arrayCount) Generates an array of arrays of objects based on the provided template.
template: Object template with keys and initial values. objectCount: Number of objects in each array. arrayCount: Number of arrays to generate.
Example:Random Numbers
numeric.integer(min, max) Generates a random integer between min and max.
min: Minimum value (inclusive). max: Maximum value (inclusive).
numeric.float() Generates a random floating-point number.
numeric.array(count) Generates an array of random floating-point numbers.
count: Number of elements in the array. person.firstName() Generates a random first name.
Example:Random names
person.lastName() Generates a random last name.
person.fullName() Generates a random full name.
person.array(count) Generates an array of random names.
count: Number of names to generate.
Example:Random email
const superFaker = new SuperFaker('EN')
const email = superFaker.email.randomEmail()
array of emails
const emails = superFaker.email.array(5)