How to use the forEach function from underscore

Find comprehensive JavaScript underscore.forEach code examples handpicked from public code repositorys.

581
582
583
584
585
586
587
588
589
});
  //Check user online status
  socket.on('get-user-online-status', function (data, callback) {
    let userId = data.userId;
    // let onlineMember = getOnlineUsers();
    // let checkUserOnline = _.forEach(onlineMember, function (result) {
    //    return result
    // }) 
    //  let isUserOffline = _.isEmpty(checkUserOnline);
fork icon0
star icon1
watch icon0

+ 11 other calls in file

422
423
424
425
426
427
428
429
430
var useRequireJs = options.useRequireJs === undefined ? true : options.useRequireJs,
    baseConfig = getBaseConfig(config, useRequireJs),
    files, filesForCoverage, preprocessors;

if (options.includeCommonFiles) {
    _.forEach(['libraryFiles', 'sourceFiles', 'specFiles', 'fixtureFiles'], function(collectionName) {
        options[collectionName] = _.flatten([commonFiles[collectionName], options[collectionName]]);
    });
}
fork icon0
star icon0
watch icon1

5
6
7
8
9
10
11
12
13
14
15
const getInternalOutboundMessages = function(sourceOutboundMessages, filters){
    let dbOutboundMessages = Creator.getCollection("workflow_outbound_messages").find(filters, {fields:{_id:1, name:1}}).fetch();
    let messages = [];


    if(!filters.is_system){
        _.forEach(sourceOutboundMessages, function(doc){
            if(!_.find(dbOutboundMessages, function(p){
                return p.name === doc.name
            })){
                messages.push(doc);
fork icon0
star icon0
watch icon1

11
12
13
14
15
16
17
18
19
20
delete filters.active;
let dbApprovalProcesses = Creator.getCollection("process_definition").find(filters, {fields:{_id:1, name:1}}).fetch();
let approvalProcesses = [];

if(!filters.is_system){
    _.forEach(sourceApprovalProcesses, function(doc){
        if(!_.find(dbApprovalProcesses, function(p){
            return p.name === doc.name
        })){
            approvalProcesses.push(doc);
fork icon0
star icon0
watch icon1

11
12
13
14
15
16
17
18
19
20
21
const getInternalActionFieldUpdates = function(sourceActionFieldUpdates, filters){
    let dbActionFieldUpdates = Creator.getCollection("action_field_updates").find(filters, {fields:{_id:1, name:1}}).fetch();
    let actionFieldUpdates = [];


    if(!filters.is_system){
        _.forEach(sourceActionFieldUpdates, function(doc){
            if(!_.find(dbActionFieldUpdates, function(p){
                return p.name === doc.name
            })){
                actionFieldUpdates.push(doc);
fork icon0
star icon0
watch icon1

24
25
26
27
28
29
30
31
32
33
let collection = await objectql.getObject("object_layouts");
let dbLayouts = await collection.directFind({filters, fields:['_id', 'name']});
let layouts = [];

if(!filters.is_system){
    _.forEach(sourceLayouts, function(doc){
        if(!_.find(dbLayouts, function(p){
            return p.name === doc.name
        })){
            layouts.push(doc);
fork icon0
star icon0
watch icon1

12
13
14
15
16
17
18
19
20
21
22
const getInternalWorkflowRules = function(sourceWorkflowRules, filters){
    let dbWorkflowRules = Creator.getCollection("workflow_rule").find(filters, {fields:{_id:1, name:1}}).fetch();
    let workflowRules = [];


    if(!filters.is_system){
        _.forEach(sourceWorkflowRules, function(doc){
            if(!_.find(dbWorkflowRules, function(p){
                return p.name === doc.name
            })){
                workflowRules.push(doc);
fork icon0
star icon0
watch icon1

5
6
7
8
9
10
11
12
13
14
15
const getInternalWorkflowNotifications = function(sourceWorkflowNotifications, filters){
    let dbWorkflowNotifications = Creator.getCollection("workflow_notifications").find(filters, {fields:{_id:1, name:1}}).fetch();
    let workflowNotifications = [];


    if(!filters.is_system){
        _.forEach(sourceWorkflowNotifications, function(doc){
            if(!_.find(dbWorkflowNotifications, function(p){
                return p.name === doc.name
            })){
                workflowNotifications.push(doc);
fork icon0
star icon0
watch icon1

169
170
171
172
173
174
175
176
177
178
    if (! self.stopped)
      runLog.log("=> Started MongoDB.");
  }
}

_.forEach(self.extraRunners, function (extraRunner) {
  if (! self.stopped) {
    var title = extraRunner.title;
    if (! self.quiet)
      runLog.logTemporary("=> Starting " + title + "...");
fork icon0
star icon0
watch icon14