How to use the lodash-es.map function in lodash-es

To help you get started, we’ve selected a few lodash-es 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 openshift / console / frontend / public / components / graphs / query-browser.jsx View on Github external
updateGraph(data, error) {
    deleteTraces(this.node, _.range(this.numTraces));
    this.numTraces = 0;

    this.data = _.get(data, '[0].data.result');

    if (!_.isEmpty(this.data)) {
      // Work out which labels have different values for different metrics
      const allLabels = _.map(this.data, 'metric');
      const allLabelKeys = _.uniq(_.flatMap(allLabels, _.keys));
      const differingLabelKeys = _.filter(allLabelKeys, k => _.uniqBy(allLabels, k).length > 1);

      _.each(this.data, ({metric, values}) => {
        // If props.metric is specified, ignore all other metrics
        const labels = _.omit(metric, '__name__');
        if (this.props.metric && _.some(labels, (v, k) => _.get(this.props.metric, k) !== v)) {
          return;
        }

        // The data may have missing values, so we fill those gaps with nulls so that the graph correctly shows the
        // missing values as gaps in the line
        const start = values[0][0];
        const end = _.last(values)[0];
        const step = this.state.span / this.props.numSamples / 1000;
        _.range(start, end, step).map((t, i) => {
github openshift / console / frontend / public / components / api-explorer.tsx View on Github external
if (!accessResponse) {
    return ;
  }

  // break into users, groups, and service accounts
  const users = [];
  const serviceAccounts = [];
  _.each(accessResponse.users, (name: string) => {
    if (name.startsWith('system:serviceaccount:')) {
      serviceAccounts.push({ name, type: 'ServiceAccount' });
    } else {
      users.push({ name, type: 'User' });
    }
  });
  const groups = _.map(accessResponse.groups, (name: string) => ({ name, type: 'Group' }));

  // filter and sort
  const verbOptions = _.zipObject(verbs, verbs);
  const data = [
    ...(showUsers ? users : []),
    ...(showGroups ? groups : []),
    ...(showServiceAccounts ? serviceAccounts : []),
  ];
  const allSelected = showUsers && showGroups && showServiceAccounts;
  const itemCount = accessResponse.users.length + accessResponse.groups.length;
  const selectedCount = data.length;
  const filteredData = data.filter(({ name }: { name: string }) => fuzzy(filter, name));
  const sortedData = _.orderBy(filteredData, ['type', 'name'], ['asc', 'asc']);

  // event handlers
  const onFilterChange: React.ReactEventHandler = (e) =>
github virtool / virtool / client / src / js / base / ScrollList.js View on Github external
render() {
        const { documents, renderRow, page, pageCount, noContainer } = this.props;

        const entries = map(documents, (item, index) => renderRow(index));

        let loading;

        if (documents === null && page < pageCount) {
            loading = ;
        }

        if (noContainer) {
            return (
                
                    {entries}
                    {loading}
                
            );
        }
github openshift / console / frontend / public / components / monitoring / metrics.tsx View on Github external
const headerPrometheusLinkStateToProps = ({ UI }: RootState, { urls }) => {
  const liveQueries = UI.getIn(['queryBrowser', 'queries']).filter(
    (q) => q.get('isEnabled') && q.get('query'),
  );
  const queryStrings = _.map(liveQueries.toJS(), 'query');
  return {
    url: getPrometheusExpressionBrowserURL(urls, queryStrings) || urls[MonitoringRoutes.Prometheus],
  };
};
github Sunbird-Ed / SunbirdEd-portal / src / app / client / src / app / modules / cbse-program / components / ckeditor-tool / ckeditor-tool.component.ts View on Github external
this.publicDataService.post(req).subscribe((res) => {
      _.map(res.result.content, (item) => {
        if (item.downloadUrl) {
          this.allImages.push(item);
        }
      });
    });
  }
github openshift / console / frontend / public / module / k8s / podvulns.jsx View on Github external
export const isSupported = podvuln => {
  return hasAccess(podvuln) ? _.every(
    _.map(podvuln.imagevulns, (imgvuln) => _.has(imgvuln, 'Features')),
    Boolean) : false;
};
github openshift / console / frontend / public / components / overview / project-overview.tsx View on Github external
flatten(): OverviewItem[] {
    return _.flatten(_.map(this.props.groups, 'items'));
  }
github Sunbird-Ed / SunbirdEd-portal / src / app / client / src / app / modules / cbse-program / components / dashboard / dashboard.component.ts View on Github external
generateTableData(report) {
    let Tdata
    if (report === this.reports[0].name) {
      Tdata = _.map(this.textBookChapters, (item) => {
        let result = {};
        result[this.firstcolumnHeader] = item.name + "(" + item.topic + ")";
        result[this.statusLabel[0].name] = (item[this.selectedCategory] && item[this.selectedCategory].review) ? item[this.selectedCategory].review : 0;
        result[this.statusLabel[1].name] = (item[this.selectedCategory] && item[this.selectedCategory].reject) ? item[this.selectedCategory].reject : 0;
        result[this.statusLabel[2].name] = (item[this.selectedCategory] && item[this.selectedCategory].live) ? item[this.selectedCategory].live : 0;
        result[this.statusLabel[3].name] = (item[this.selectedCategory] && item[this.selectedCategory].published) ? item[this.selectedCategory].published : 0;
        return result;
      });
      this.tableData = Tdata;

    } else if (report === this.reports[1].name) {
      Tdata = _.map(this.textBookChapters, (item) => {
        let result = {};
        result[this.firstcolumnHeader] = item.name + "(" + item.topic + ")";
        result[this.questionTypeName[this.questionType[0]]] = (item[this.questionType[0]] && item[this.questionType[0]].published) ? item[this.questionType[0]].published : 0;
        result[this.questionTypeName[this.questionType[1]]] = (item[this.questionType[1]] && item[this.questionType[1]].published) ? item[this.questionType[1]].published : 0;
        result[this.questionTypeName[this.questionType[2]]] = (item[this.questionType[2]] && item[this.questionType[2]].published) ? item[this.questionType[2]].published : 0;
        result[this.questionTypeName[this.questionType[3]]] = (item[this.questionType[3]] && item[this.questionType[3]].published) ? item[this.questionType[3]].published : 0;
        result[this.questionTypeName[this.questionType[4]]] = (item[this.questionType[4]] && item[this.questionType[4]].published) ? item[this.questionType[4]].published : 0;
        return result;
      });
      this.tableData = Tdata;
    }
  }
github virtool / virtool / client / src / js / analyses / components / Create.js View on Github external
export const SamplesList = ({ samples }) => {
    const sampleComponents = map(samples, ({ id, name }) => (
        
            {name}
        
    ));

    let labelContent = "Sample";

    const style = {
        maxHeight: "220px"
    };

    if (samples.length > 1) {
        labelContent = (
            <span>
                Samples {samples.length}
            </span>
github virtool / virtool / client / src / js / samples / components / Create / ReadSelector.js View on Github external
componentDidUpdate(prevProps) {
        if (this.props.files !== prevProps.files) {
            prevProps.onSelect(intersection(prevProps.selected, map(this.props.files, "id")));
        }
    }