console-hub/html/utils.js
2019-12-30 21:29:12 +01:00

29 lines
No EOL
567 B
JavaScript

const User = require("./views/data/user");
const Card = require("./views/data/card");
function removeChildNodes(node){
while (node.firstChild) {
node.removeChild(node.firstChild);
}
}
function getUsers(){
var user = new User;
user.name = "Test";
user.avatar = "https://api.adorable.io/avatars/285/test";
return [user];
}
function usersToCards(users){
var cards = [];
users.forEach((u, i)=>{
cards[i] = u.getCard();
})
return cards;
}
module.exports = {
removeChildNodes,
getUsers,
usersToCards
}