TakeRest Data Generator
Install
npm i takerest-data-generator
Usage
API Methods
Combinations
Combine all the possible combinations of two or more lists.
var generator = require('takerest-data-generator');
var data = {
"points": [80],
"name": ["Steve", "Adam"]
};
console.log(generator.combinations({data}));
/*
outputs:
{
"data": [{
"points": 80,
"name": "Steve"
},{
"points": 80,
"name": "Adam"
}]
}
*/
Custom rows
Generating a lot of realistic test data.
var generator = require('takerest-data-generator');
var opts = {
data: {
"First name": {
"type": "firstName"
},
"Last name": {
"type": "lastName"
},
"Age": {
"type": "integer",
"min": 18,
"max": 65
}
},
"rowsCount": 2
};
console.log(generator.customRow(opts));
/*
outputs:
{
"data": [{
"First name": "Justyn",
"Last name": "Rowe",
"Age": 58
},{
"First name": "Jaylon",
"Last name": "Weber",
"Age": 22
}]
}
*/
Data Type Generators
Use this functions to generate fake random data
- Name:
- firstName (min, max)
- lastName (min, max)
- fullName (min, max)
- prefix (min, max)
- suffix (min, max)
- Address:
- country (min, max)
- countryCode (min, max)
- state (min, max)
- stateCode (min, max)
- county (min, max)
- city (min, max)
- addressPrimary (min, max)
- addressSecondary (min, max)
- zipCode (min, max)
- latitude
- longitude
- Internet:
- email (min, max)
- userName (min, max)
- domainName (min, max)
- ip
- ipv6
- Number:
- integer (min, max)
- float (min, max)
- Phone:
- phoneCountryCode (min, max)
- phoneNumberFormat (min, max)
- phoneNumber (min, max)
- Date and Time
- currentDate
- pastDate (days)
- futureDate (days)
- rangeDate (from, to)
- currentTime (format)
- pastTime (format, mins)
- futureTime (format, mins)
- rangeTime (format, from, to)
- currentDateTime (format)
- pastDateTime (format, mins, days)
- futureDateTime (format, mins, days)
- rangeDateTime (format, from, to)
- timestamp (min, max)
- Time Zone:
- timezone
- Boolean:
- boolean
- Credit Card:
- cardType
- cardNumber
- Currency:
- currencyCode
- currencySymbol
- Text:
- words (min, max)
- sentences (min, max)
- paragraphs (min, max)
- Color:
- color