How to use the lodash.forEach function in lodash

To help you get started, we’ve selected a few lodash examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jimivdw / grunt-mutation-testing / utils / ExclusionUtils.js View on Github external
function parseASTComments(astNode) {
    var comments = [];
    if(astNode && astNode.leadingComments) {
        _.forEach(astNode.leadingComments, function(comment) {
            if(comment.type === 'Block') {
                comments = comments.concat(comment.value.split('\n').map(function(commentLine) {
                    // Remove asterisks at the start of the line
                    return commentLine.replace(/^\s*\*\s*/g, '').trim();
                }));
            } else {
                comments.push(comment.value);
            }
        });
    }

    return comments;
}
github ximing / xmexcel / packages / view / utils / util.js View on Github external
_.forEach(row, (cell, colKey) => {
            style[rowKey][colKey] = cell;
            let tempCellStyle = cell.s;
            cell.s = {};
            /* xfs[cell.s]
            * {
                    font: 0,
                    color: 2,
                    bgColor: 0
              }
            * */
            _.forEach(xfs[tempCellStyle], (val, xfsKey) => {
                //处理 styles 是数组的情况 font: [['b', 'i', 's', 'u']], border: [['left', 'right']],
                //xfsKey 为  font border color等
                if (Array.isArray(styles[xfsKey][val])) {
                    styles[xfsKey][val].forEach(v => {
                        cell.s[v] = true;
                    });
                } else {
                    cell.s[xfsKey] = styles[xfsKey][val];
                }
            });
        });
    });
github appnexus / anx-api / src / api.spec.ts View on Github external
describe(param, () => {
							_.forEach(tests, (test) => {
								const newOpts: any = {};
								if (param !== 'uri') {
									newOpts.uri = '/user';
								}
								newOpts[param] = test.value;
								if (test.message) {
									it(param + ' should not accept ' + test.value, (done) => {
										expectValidationError(newOpts, test.message, done);
									});
								} else {
									it(param + ' should accept ' + test.value, () => {
										return api.request(newOpts).then(() => {
											if (test.uriContains) {
												expect(_.includes(reqOpts.uri, test.uriContains)).toBe(true);
											}
											return null;
github sskyy / zero / system / modules / dev / index.js View on Github external
(function _cleanCircular(obj, namespace) {
    _.forEach(obj, function (v, k) {
      if (!obj.hasOwnProperty(k)) return
      var i = cached.indexOf(v)

      if (v === obj) {
        obj[k] = "{circular reference of root object}"
      } else if (i !== -1) {
        obj[k] = "{circular reference of " + cachedNamespace[i] + "}"
      } else {
        if (_.isArray(v) || _.isObject(v)) {
          cached.push(v)
          namespace.push(k)
          cachedNamespace.push(namespace.join('.'))
          _cleanCircular(v, namespace)
        }
      }
    })
github aloysius-pgast / crypto-exchanges-gateway / app / default-ccxt-client.js View on Github external
formatBalances(ccxtData)
{
    let result = {};
    _.forEach(ccxtData.total, (balance, currency) => {
        if (0 == balance)
        {
            return;
        }
        result[currency] = this.formatBalance(currency, ccxtData[currency]);
    });
    return result;
}
github RackHD / on-web-ui / src / app / settings / setting-form.component.ts View on Github external
handleAuthEnabled(value: boolean) {
    let authItems = ["rackhdPassword", "rackhdUsername", "rackhdAuthToken"];
    _.forEach(authItems, (item) => {
      let formItem = this.settingFormGroup.get('rackhdAuth.' + item);
      value ? formItem.enable() : formItem.disable();
    })
  }
github appirio-tech / connect-app / src / projects / detail / ProjectDetail.jsx View on Github external
_.forEach(template.sections, (section) => {
      _.forEach(section.subSections, (subSection) => {
        if (subSection.type === 'questions') {
          _.forEach(subSection.questions, (question) => {
            if(question.type === 'estimation') {
              estimationQuestion = question
              estimationQuestion.title = 'Project Scope'
              return false
            }
          })
        }
      })
    })
  }
github gaoxiaoliangz / readr / core / server / api-v2 / api-methods-old.js View on Github external
function getIdMatch(options) {
  if (options.id) {
    return { _id: options.id }
  }

  const match = {}
  _.forEach(options, (val, key) => {
    if (key.indexOf('id')) {
      match[key] = val
    }
  })

  return match
}
github acvetkov / sinon-chrome / src / chrome / index.js View on Github external
function wrapProperties(object, namespace, properties) {
    _.forEach(properties, property => {
        appendProperty(object, namespace, property);
    });
}
github zanata / zanata-platform / server / zanata-frontend / src / app / reducers / glossary-reducer.js View on Github external
[GLOSSARY_TERMS_SUCCESS]: (state, action) => {
    let terms = {}
    forEach(action.payload.entities.glossaryTerms, (entry) => {
      terms[entry.id] = GlossaryHelper.generateEntry(entry, state.locale)
    })

    return {
      ...state,
      termsLoading: false,
      termsLastUpdated: action.meta.receivedAt,
      terms,
      termIds: action.payload.result.results,
      termCount: action.payload.result.totalCount
    }
  },
  [GLOSSARY_TERMS_FAILURE]: (state, action) => ({