README
voiceboxer-traverse-event-users
Traverse all users in a VoiceBoxer event object.
npm install voiceboxer-traverse-event-users
Usage
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
).