simpsonify
v1.0.0
Published
Provides generic and customisable user test data with a Simpsons twist
Downloads
2
Readme
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 from
Example
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: '[email protected]',
avatarUrl: 'https://goo.gl/VBV6pj'
},
{
firstName: 'Marge',
lastName: 'Simpson',
email: '[email protected]',
avatarUrl: 'https://goo.gl/ULr95z'
}
]