Created
May 12, 2022 20:25
-
-
Save rgoldfinger-quizlet/7afad7d346e5a9ec1cb02ea9e0f4c5cb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { queryDb } from 'qdb'; | |
function lookupUser(userId, includeAdmin) { | |
return queryDb( | |
'SELECT * FROM users WHERE id = ' + userId | |
); | |
} | |
function lookupUsers(userIds) { | |
users = []; | |
for (i = 0; i < userIds.length; i++) { | |
users[i] = lookupUser(userIds[i]); | |
} | |
return users; | |
} | |
/** | |
* @param {Number[]} userIds | |
* @returns {String} of HTML fragment for unordered list of the users' display names | |
*/ | |
function listUsers(userIds) { | |
users = lookupUsers(userIds); | |
return new String( | |
'<ul>' + users.map(u => '<li>' + u['displayName'] + '</li>') + '</ul>>' | |
); | |
} | |
export default listUsers; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment