How to use the mout/array/forEach function in mout

To help you get started, we’ve selected a few mout 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 cam-inc / viron / src / store / getters / endpoints.js View on Github external
tagsFiltered: (state, maxSize) => {
    const version = state.application.version;
    let endpoints = ObjectAssign({}, state.endpoints[version]);
    endpoints = sortByOrder(endpoints);
    let tags = [];
    forEach(endpoints, endpoint => {
      forEach(endpoint.tags || [], tag => {
        tags.push(tag);
      });
    });
    tags = unique(tags, (a, b) => {
      return a === b;
    });
    let filterText = state.application.endpointTempFilterText;
    filterText = filterText.replace(/ /g, ' ');// eslint-disable-line no-irregular-whitespace
    filterText = filterText.replace(/,/g, ' ');
    const targetTexts = filter((filterText || '').split(' '), targetText => {
      return !!targetText;
    });
    if (!!targetTexts.length) {
      tags = filter(tags, name => {
        let isMatched = true;
github cam-inc / viron / src / core / swagger.js View on Github external
'minLength',
      'pattern',
      'maxItems',
      'minItems',
      'uniqueItems',
      'maxProperties',
      'minProperties',
      'required',
      'enum',
      //'type',// removed on purpose. type will be customized by dmc.
      'items',
      'allOf',
      'properties',
      'additionalProperties'
    ];
    forEach(schemaObjectKeys, v => {
      ret[`_${v}`] = schema[v];
      ret[`get${v.charAt(0).toUpperCase()}${v.slice(1)}`] = function() {
        return this[`_${v}`];
      };
    });

    switch (type) {
    case 'null':
      ret._type = 'null';
      ret._value = null;
      ret._rawValue = null;
      break;
    case 'boolean':
      ret._type = 'boolean';
      ret._value = response;
      ret._rawValue = response;
github cam-inc / viron / src / store / getters / components.js View on Github external
columns: (state, componentId) => {
    const component = state.components[componentId];
    // `table_labels` = 優先度が高いカラムkey群。
    const tableLabels = component.def.table_labels || [];
    // `sort` = ソート可能なkey群。
    const sortableKeys = component.def.sort || [];
    const columns = [];
    forEach(component.columns, column => {
      columns.push(ObjectAssign({}, column, {
        isSortable: contains(sortableKeys, column.key)
      }));
    });
    return sort(columns, (a, b) => {
      let idxA = indexOf(tableLabels, a.key);
      let idxB = indexOf(tableLabels, b.key);
      if (idxA >= 0) {
        idxA = tableLabels.length - idxA;
      }
      if (idxB >= 0) {
        idxB = tableLabels.length - idxB;
      }
      return (idxB - idxA);
    });
  },
github cam-inc / viron / src / pages / viron-components / card / table / index.js View on Github external
this.handleRowTap = e => {
    const name = 'preview';
    // プレビュー用に擬似的なParameterObjectsを作成する。
    const properties = {};
    forEach(this.columns, column => {
      const property = deepClone(column);
      const key = property.key;
      delete property.key;
      properties[key] = property;
    });
    const parameterObjects = [{
      'in': 'body',
      name,
      schema: {
        type: 'object',
        properties
      }
    }];
    // プレビュー用に擬似的なinitialValueを作成する。
    const dataList = [];
    forEach(this.data, data => {
github cam-inc / viron / src / components / pages / viron-components / index.js View on Github external
this.getCurrentSearchRequestParametersForComponent = component => {
    const parameterObjects = store.getter(getters.OAS_PARAMETER_OBJECTS, component.api.path, component.api.method);
    const names = [];
    forEach(parameterObjects, parameterObject => {
      names.push(parameterObject.name);
    });
    return objectReject(this.currentSearchRequestParameters, (v, k) => {
      return !contains(names, k);
    });
  };
  // 現在の検索用パラメータ値をリセットします。
github cam-inc / viron / src / store / getters / oas.js View on Github external
forEach(methods, method => {
        const isOperationObjectDefined = !!state.oas.client.spec.paths[actionBasePath] && !!state.oas.client.spec.paths[actionBasePath][method];
        if (!isOperationObjectDefined) {
          return;
        }
        pathRefs.push({
          path: actionBasePath,
          method,
          appendTo
        });
      });
    });

    // OperationObject群を抽出します。
    const operationObjects = [];
    forEach(pathRefs, ref => {
      const operationObject = state.oas.client.spec.paths[ref.path][ref.method];
      operationObjects.push(ObjectAssign({
        operationObject
      }, ref));
    });

    return operationObjects;
  },
github cam-inc / viron / src / components / viron-parameters / validator.js View on Github external
const _enum = (value, constraints) => {
  const result = ObjectAssign({}, resultTemplate);
  if (!hasOwn(constraints, 'enum')) {
    return result;
  }
  const _enum = constraints.enum;
  if (!isArray(_enum)) {
    return result;
  }
  let isFound = false;
  forEach(_enum, item => {
    if (value === item) {
      isFound = true;
    }
  });
  if (!isFound) {
    result.isValid = false;
    result.message = `${JSON.stringify(_enum)}のいずれかの値を設定して下さい。`;
  }
  return result;
};
github cam-inc / viron / src / components / organisms / viron-component / table.js View on Github external
this.getRows = () => {
    const rows = [];
    forEach(this.opts.response, cells => {
      const row = {};
      forOwn(cells, (cell, key) => {
        row[key] = cell;
      });
      rows.push(row);
    });
    return rows;
  };
github cam-inc / viron / src / components / viron-parameters / form / index.js View on Github external
this.getSelectOptions = () => {
    const options = [];
    const enumDescriptions = formObject['x-enum-descriptions'] || {};
    if (isUndefined(this.opts.val)) {
      options.push({
        label: '-- select an option --',
        value: undefined,
        isSelected: true,
        isDiabled: true
      });
    }
    forEach(formObject.enum, (v, idx) => {
      options.push({
        id: `select_${idx}`,
        label: enumDescriptions[v] || v,
        value: v,
        isSelected: (v === this.opts.val)
      });
    });
    return options;
  };
github cam-inc / viron / src / pages / viron-components / index.js View on Github external
this.getCrossSearchQueriesByDef = def => {
    const ret = {};
    forEach(def.query, query => {
      ret[query.key] = this.crossSearchQueries[query.key];
    });
    return ret;
  };