1.0.0 • Published 7 years ago
simpsonify v1.0.0
Simpsonify
Provides generic and customisable user test data with a Simpsons twist
Check it out live in action here!
Installation
npm install simpsonify
Usage
User properties available:
firstName
: string - User first namelastName
: string - User last nameemail
: string - User email in valid formatavatarUrl
: string - Valid url to user avatar
Available Methods
getUsers
Returns up to 28 unique Simpsons users with default properties and the option to include additional custom properties
Parameters:
count
: desired number of user results returnedcustomProps
: array of additional properties for each user. Each property object includes the property name and an array of possible values to be randomly selected fromExample
const props = [ { name: 'occupation', values: ['Developer', 'Engineer', 'Teacher', 'Doctor'] }, { name: 'nationality'. values: ['New Zealand', 'Australia', 'Canada', 'Japan', 'Germany'] } ]; getUsers(5, props);
Returns
[
{
firstName: 'Homer',
lastName: 'Simpson',
email: 'homer.simpson@springfield.com',
avatarUrl: 'https://goo.gl/VBV6pj'
},
{
firstName: 'Marge',
lastName: 'Simpson',
email: 'marge.simpson@springfield.com',
avatarUrl: 'https://goo.gl/ULr95z'
}
]