• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript lodash.filter函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中lodash.filter函数的典型用法代码示例。如果您正苦于以下问题:TypeScript filter函数的具体用法?TypeScript filter怎么用?TypeScript filter使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了filter函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: repeatPanel

  repeatPanel(panel, row) {
    var variable = _.find(this.variables, {name: panel.repeat});
    if (!variable) { return; }

    var selected;
    if (variable.current.text === 'All') {
      selected = variable.options.slice(1, variable.options.length);
    } else {
      selected = _.filter(variable.options, {selected: true});
    }

    _.each(selected, (option, index) => {
      var copy = this.getPanelClone(panel, row, index);
      copy.span = Math.max(12 / selected.length, panel.minSpan || 4);
      copy.scopedVars = copy.scopedVars || {};
      copy.scopedVars[variable.name] = option;
    });
  }
开发者ID:PaulMest,项目名称:grafana,代码行数:18,代码来源:dynamic_dashboard_srv.ts


示例2: _populateFunctions

 private _populateFunctions(): void {
     const functionsAbi = _.filter(this.abi, abiPart => abiPart.type === AbiType.Function) as FunctionAbi[];
     _.forEach(functionsAbi, (functionAbi: MethodAbi) => {
         if (functionAbi.constant) {
             const cbStyleCallFunction = this._contract[functionAbi.name].call;
             this[functionAbi.name] = promisify(cbStyleCallFunction, this._contract);
             this[functionAbi.name].call = promisify(cbStyleCallFunction, this._contract);
         } else {
             const cbStyleFunction = this._contract[functionAbi.name];
             const cbStyleCallFunction = this._contract[functionAbi.name].call;
             const cbStyleEstimateGasFunction = this._contract[functionAbi.name].estimateGas;
             this[functionAbi.name] = this._promisifyWithDefaultParams(cbStyleFunction);
             this[functionAbi.name].estimateGasAsync = promisify(cbStyleEstimateGasFunction);
             this[functionAbi.name].sendTransactionAsync = this._promisifyWithDefaultParams(cbStyleFunction);
             this[functionAbi.name].call = promisify(cbStyleCallFunction, this._contract);
         }
     });
 }
开发者ID:ewingrj,项目名称:0x-monorepo,代码行数:18,代码来源:contract.ts


示例3: getCapAlignment

export function getCapAlignment(polyhedron: Polyhedron, cap: Cap) {
  const isRhombicosidodecahedron = cap.type === 'cupola';
  const orthoCaps = isRhombicosidodecahedron
    ? _.filter(
        Cap.getAll(polyhedron),
        cap => getCupolaGyrate(polyhedron, cap) === 'ortho',
      )
    : [];

  const otherNormal =
    orthoCaps.length > 0
      ? getSingle(orthoCaps)
          .boundary()
          .normal()
      : polyhedron.largestFace().normal();

  return isInverse(cap.normal(), otherNormal) ? 'para' : 'meta';
}
开发者ID:tessenate,项目名称:polyhedra-viewer,代码行数:18,代码来源:cutPasteUtils.ts


示例4: it

        it('should be able to set all recipe ingredients', () => {

            let recipe = RecipeMock.entity();

            let leftoverIngredient = MealLeftoverIngredient.convertToMealLeftoverIngredient(_.head(recipe._ingredients));

            let meal = new Meal({
                _recipes: [recipe],
                _leftoverIngredients: [leftoverIngredient]
            });

            expect(
                _.filter(meal.__allRecipeIngredients, (recipeIngredient:ISelectedRecipeIngredient) => {
                    return recipeIngredient.selected;
                }).length
            ).to.equal(1);

        });
开发者ID:swordman1205,项目名称:angular-typescript-material,代码行数:18,代码来源:mealModel.spec.ts


示例5: getOverlappingStudies

export default function getOverlappingStudies(studies: CancerStudy[]):CancerStudy[][] {
    const groupedTCGAStudies = _.reduce(studies,(memo, study:CancerStudy)=>{
        if (/_tcga/.test(study.studyId)) {
            // we need to find when root of study name is in duplicate, so strip out the modifiers (pub or pancan)
            const initial = study.studyId.replace(/(_\d\d\d\d|_pub|(_pub\d\d\d\d)|_pan_can_atlas_\d\d\d\d)$/g,'');
            if (initial) {
                if (initial in memo) {
                    memo[initial].push(study);
                } else {
                    memo[initial] = [study];
                }
            }
        }

        return memo;
    }, {} as { [studyId:string]:CancerStudy[] });
    return _.filter(groupedTCGAStudies, (grouping)=>grouping.length > 1);
}
开发者ID:agarwalrounak,项目名称:cbioportal-frontend,代码行数:18,代码来源:getOverlappingStudies.ts


示例6: populateFunctions

 private populateFunctions(): void {
     const functionsAbi = _.filter(this.abi, abiPart => abiPart.type === AbiType.Function);
     _.forEach(functionsAbi, (functionAbi: Web3.MethodAbi) => {
         if (functionAbi.constant) {
             const cbStyleCallFunction = this.contract[functionAbi.name].call;
             this[functionAbi.name] = {
                 callAsync: promisify(cbStyleCallFunction, this.contract),
             };
         } else {
             const cbStyleFunction = this.contract[functionAbi.name];
             const cbStyleEstimateGasFunction = this.contract[functionAbi.name].estimateGas;
             this[functionAbi.name] = {
                 estimateGasAsync: promisify(cbStyleEstimateGasFunction, this.contract),
                 sendTransactionAsync: this.promisifyWithDefaultParams(cbStyleFunction),
             };
         }
     });
 }
开发者ID:linki,项目名称:0x.js,代码行数:18,代码来源:contract.ts


示例7: getExecutionDefinitionsAndColumns

function getExecutionDefinitionsAndColumns(mdObj: any, options: any, attributesMap: any) {
    const measures = getMeasures(mdObj);
    let attributes = getAttributes(mdObj);

    const metrics = flatten(map(measures, (measure, index) =>
        getMetricFactory(measure, mdObj)(measure, mdObj, index, attributesMap))
    );
    if (options.removeDateItems) {
        attributes = filter(attributes, attribute => !isDateAttribute(attribute, attributesMap));
    }
    attributes = map(attributes, partial(categoryToElement, attributesMap, mdObj));

    const columns = compact(map([...attributes, ...metrics], 'element'));
    return {
        columns,
        definitions: sortDefinitions(compact(map(metrics, 'definition')))
    };
}
开发者ID:gooddata,项目名称:gooddata-js,代码行数:18,代码来源:experimental-executions.ts


示例8:

        ]).spread((uiDescriptor) => {
            let vm = parentContext.object._vm;
            context.object = _.map(_.reject(
                    _.filter(parentContext.object.devices, {type: this.vmRepository.DEVICE_TYPE.VOLUME}),
                    {properties: {type: 'NFS'}}
                ),
                volume => _.assign(volume, {
                    _objectType: objectType,
                    _vm: vm,
                    id: uuid.v4()
                })
            );
            context.object._vm = parentContext.object;
            context.object._objectType = objectType;
            context.userInterfaceDescriptor = uiDescriptor;

            return this.updateStackWithContext(this.stack, context);
        });
开发者ID:mactanxin,项目名称:gui,代码行数:18,代码来源:vms.ts


示例9: function

 formatter: function () {
   //TODO: check this
   //let s = '<b>' + Highcharts.dateFormat('%A, %b %d, %H:%M', new Date(this.x)) + '</b>';
   let dateFormat = newOptions.dateFormat || '%A, %b %d, %H:%M';
   let s = '<b>' + Highcharts.dateFormat(dateFormat, this.x) + '</b>';
   if (_.filter(this.points, (point: any) => {
       return point.y !== 0;
     }).length) {
     _.forEach(this.points, function (point) {
       if (point.y) {
         let name = ' ' + (point.series.options.labelPrefix ? point.series.options.labelPrefix + ' ' + point.series.name : point.series.name);
         s += '<br /><span style="color:' + point.color + '">\u25CF</span>' + name + ': <b>' + (point.series.options.decimalFormat?Highcharts.numberFormat(point.y, 2):point.y) +
           (point.series.options.labelSuffix?point.series.options.labelSuffix:'') + '</b>';
       }
     });
   }
   return s;
 },
开发者ID:gravitee-io,项目名称:gravitee-management-webui,代码行数:18,代码来源:chart.directive.ts


示例10: cleanDashboardFromIgnoredChanges

  // remove stuff that should not count in diff
  cleanDashboardFromIgnoredChanges(dashData) {
    // need to new up the domain model class to get access to expand / collapse row logic
    let model = new DashboardModel(dashData);

    // Expand all rows before making comparison. This is required because row expand / collapse
    // change order of panel array and panel positions.
    model.expandRows();

    let dash = model.getSaveModelClone();

    // ignore time and refresh
    dash.time = 0;
    dash.refresh = 0;
    dash.schemaVersion = 0;

    // ignore iteration property
    delete dash.iteration;

    dash.panels = _.filter(dash.panels, panel => {
      if (panel.repeatPanelId) {
        return false;
      }

      // remove scopedVars
      panel.scopedVars = null;

      // ignore panel legend sort
      if (panel.legend) {
        delete panel.legend.sort;
        delete panel.legend.sortDesc;
      }

      return true;
    });

    // ignore template variable values
    _.each(dash.templating.list, function(value) {
      value.current = null;
      value.options = null;
      value.filters = null;
    });

    return dash;
  }
开发者ID:cboggs,项目名称:grafana,代码行数:45,代码来源:change_tracker.ts



注:本文中的lodash.filter函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript lodash.find函数代码示例发布时间:2022-05-25
下一篇:
TypeScript lodash.fill函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap