1.1.2 • Published 5 years ago
voiceboxer-traverse-event-users v1.1.2
voiceboxer-traverse-event-users
Traverse all users in a VoiceBoxer event object.
npm install voiceboxer-traverse-event-usersUsage
Pass an event or a live event instance to the forEach, map or find function.
var traverse = require('voiceboxer-traverse-event-users');
var event = {
moderator: { email: 'moderator@example.com', id: 'modid' },
presenters: [
{ email: 'presenter0@example.com', id: 'preid0' },
{ email: 'presenter1@example.com', id: 'preid1' }
]
};
traverse(event, function(user, path, role) {
console.log(user, path, role);
});The above would yield three users to the callback function, which gets the user instance, path to the object (e.g. ['presenters', 0]) and the user role (moderator, presenter, interpreter or audience).