UNPKG

@habib2005/my-custom-package

Version:
22 lines (12 loc) 402 B
// index.js function generateRandomUserId() { return Math.floor(Math.random() * 200); } async function getRandomUser(name) { const userId = generateRandomUserId(); const url =` https://dummyjson.com/users/${userId}`; const response = await fetch(url); const user = await response.json(); return user } module.exports = { getRandomUser };