@dudadev/random-img
v1.0.1
Published
Generates a random user image from randomuser.me
Downloads
25
Readme
Random Avatar URL
Generates a random avatar URL from randomuser.me
Usage
npm install --save @dudadev/random-img
The main export is a function that returns a promise:
const imgGen = require('@dudadev/random-img');
imgGen().then(avatarURL => {...});
If invoked without options, the function will return a random avatar.
Configuration
options.gender
Can be either men
or women
, to ask for a specific gender.
options.id
Can be a number between 1-96 to ask for a consistent id.
Example
imgGen({ gender: 'men', id: 5 })
.then(avatarUrl => /* will be the same image on every call of the function */)