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

TypeScript underscore.find函数代码示例

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

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



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

示例1: build

  public async build(executionReport: IExecutionReport): Promise<{ container: Dom; gridOptions: agGridModule.GridOptions }> {
    const preprocessQuerySection = find(executionReport.children, child => child.name == EXECUTION_REPORT_SECTION.PREPROCESS_QUERY);
    if (!preprocessQuerySection) {
      return this.buildFallbackEmptyTable(executionReport);
    }

    const originalLongQuery = preprocessQuerySection.result.in.lq;
    const topClicksSection = find(preprocessQuerySection.children, child => child.name == EXECUTION_REPORT_SECTION.TOP_CLICKS) as
      | IExecutionReportITDSection
      | undefined;

    if (!topClicksSection || !originalLongQuery) {
      return this.buildFallbackEmptyTable(executionReport);
    }

    const { container, agGridElement } = ExecutionReport.standardSectionHeader('Large Query Intelligent Term Detection (ITD)');
    let gridOptions: agGridModule.GridOptions;

    const dataSource = [
      {
        'Original large query': this.buildOriginalLongQueryCell(originalLongQuery, topClicksSection.refinedQueries),
        'Keyword(s) extracted': this.buildRefinedQueryCell(executionReport, topClicksSection.refinedQueries, preprocessQuerySection)
      }
    ];

    const tableBuilder = await new TableBuilder().build(dataSource, agGridElement, {
      rowHeight: 300
    });
    gridOptions = tableBuilder.gridOptions;

    return { container, gridOptions };
  }
开发者ID:coveo,项目名称:search-ui,代码行数:32,代码来源:ExecutionReportITDSection.ts


示例2: extractDocumentInfoFromBoost

  private async extractDocumentInfoFromBoost(
    results: IQueryResult[],
    permanentID: string,
    rankingExpression: IRankingExpression,
    bindings: IComponentBindings
  ) {
    let matchingResult = {
      result: null,
      returnedByIndexForCurrentQuery: false
    };

    const resultInResultSet = find(results, result => {
      return result.raw.permanentid == permanentID || result.raw.urihash == permanentID;
    });

    if (resultInResultSet) {
      matchingResult = {
        result: resultInResultSet,
        returnedByIndexForCurrentQuery: true
      };
      return matchingResult;
    }

    const queryBuilder = new QueryBuilder();
    queryBuilder.advancedExpression.add(rankingExpression.expression);
    const resultsFromIndex = await bindings.queryController.getEndpoint().search(queryBuilder.build());
    matchingResult = {
      result: resultsFromIndex.results[0],
      returnedByIndexForCurrentQuery: false
    };

    return matchingResult;
  }
开发者ID:coveo,项目名称:search-ui,代码行数:33,代码来源:ExecutionReportRankingModifiers.ts


示例3: thumbnail

  private thumbnail(result: IQueryResult, bindings: IResultsComponentBindings) {
    let dom: Dom;

    if (bindings && result) {
      const resultLists = bindings.searchInterface.getComponents('ResultList') as ResultListModule.ResultList[];
      const firstActiveResultList = find(resultLists, resultList => !resultList.disabled);

      if (firstActiveResultList) {
        dom = $$('div', {
          className: 'coveo-relevance-inspector-result-thumbnail'
        });
        firstActiveResultList.buildResult(result).then(builtResult => {
          dom.append(builtResult);
        });
      } else {
        dom = $$('a', {
          className: 'CoveoResultLink'
        });
        new ResultLink(dom.el, { alwaysOpenInNewWindow: true }, bindings, result);
      }

      if (this.currentFilter) {
        this.highlightSearch(dom.el, this.currentFilter);
      }
    } else {
      dom = $$('div', undefined, '-- NULL --');
    }

    return dom;
  }
开发者ID:coveo,项目名称:search-ui,代码行数:30,代码来源:TableBuilder.ts


示例4: view_validate

 manager.set_state(widgetStateObject).then(function(models) {
     let tags = element.querySelectorAll('script[type="application/vnd.jupyter.widget-view+json"]');
     for (let i=0; i!=tags.length; ++i) {
         // TODO: validate view schema
         let viewtag = tags[i];
         let widgetViewObject = JSON.parse(viewtag.innerHTML);
         let valid = view_validate(widgetViewObject);
         if (!valid) {
             console.error('View state has errors.', view_validate.errors);
         }
         let model_id = widgetViewObject.model_id;
         let model = _.find(models, function(item : WidgetModel) {
             return item.model_id == model_id;
         });
         if (model !== undefined) {
             if (viewtag.previousElementSibling &&
                 viewtag.previousElementSibling.matches('img.jupyter-widget')) {
                 viewtag.parentElement.removeChild(viewtag.previousElementSibling);
             }
             let widgetTag = document.createElement('div');
             widgetTag.className = 'widget-subarea';
             viewtag.parentElement.insertBefore(widgetTag, viewtag);
             manager.display_model(undefined, model, { el : widgetTag });
         }
     }
 });
开发者ID:mmeanwe,项目名称:ipywidgets,代码行数:26,代码来源:embed-webpack.ts


示例5: function

		events.forEach(function(e){
			var eventName = e.trim();
			if(!that.callbacks){
				that.callbacks = {};
			}
			if(!that.callbacks[eventName]){
				that.callbacks[eventName] = [];
			}
			if(!cb){
				that.callbacks[eventName].pop();
			}
			else{
				that.callbacks[eventName] = _.without(
					that.callbacks[eventName], _.find(
						that.callbacks[eventName], function(item){
							return item.toString() === cb.toString()
						}
					)
				);
			}

			var propertiesChain = eventName.split('.');
			if(propertiesChain.length > 1){
				var prop = propertiesChain[0];
				propertiesChain.splice(0, 1);
				if(!this[prop] || !this[prop].on){
					throw "Property " + prop + " is undefined in " + eventName;
				}
				this[prop].unbind(propertiesChain.join('.'));
			}
		}.bind(this));
开发者ID:entcore,项目名称:infra-front,代码行数:31,代码来源:lib.ts


示例6:

  pulls.then((body)=>{
        var pull = _.find(JSON.parse(body), (item) =>{
          return item.title.indexOf(branchName)>-1 && item.state === "open";
      });
      
      if(pull){
          
           var options = {
      uri: "https://api.github.com/repos/saulmadi/acklen-slackbot/pulls/" + pull.number+"/merge?access_token=4dcf4b3298bc38faa8bc348ae93fcb4f62aa549b",
      method: "PUT",
      headers:{
          "User-Agent": "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.90 Safari/537.36"
      },
      body : JSON.stringify({
          "commit_message": "merge pull request for" + branchName,
          "sha": pull.head.sha
      })
    
  };
 return this.httpClient(options);
          
          
          
      }else{ console.log("la cague");}
      
  })
开发者ID:DouglasPonce85,项目名称:acklen-slackbot,代码行数:26,代码来源:githubService.ts


示例7: return

 var valuesToBuildWith = _.map(facetValues, facetValue => {
   return (
     _.find(this.facet.values.getAll(), (valueAlreadyInFacet: FacetValue) => {
       return valueAlreadyInFacet.value == facetValue.value;
     }) || facetValue
   );
 });
开发者ID:coveo,项目名称:search-ui,代码行数:7,代码来源:FacetSearchValuesList.ts


示例8: title

	title(node: TreeNode): string {
		const c = find(this.cache, (i: [TreeNode, string]) => i[0] === node);
		if (c) {
			return c[1];
		}
		return '';
	}
开发者ID:xuender,项目名称:family,代码行数:7,代码来源:node-titler.ts


示例9:

 $scope.$watch('$ctrl.item.dimInfo.tag', () => {
   if (vm.item.dimInfo) {
     vm.selected = _.find(itemTags, (tag) => {
       return tag.type === vm.item.dimInfo.tag;
     });
   }
 });
开发者ID:bhollis,项目名称:DIM,代码行数:7,代码来源:item-tag.component.ts


示例10:

  vm.$onInit = () => {
    vm.hiddenColumns = 0;
    if (vm.perksOnly) {
      if (_.find(vm.talentGrid.nodes, { hash: infuseHash })) {
        vm.hiddenColumns += 1;
      }
      if (_.find(vm.talentGrid.nodes, { hash: 2133116599 })) {
        vm.hiddenColumns += 1;
      }
    }

    if (vm.talentGrid) {
      const visibleNodes = vm.talentGrid.nodes.filter((n) => !n.hidden);
      vm.numColumns = _.max(visibleNodes, (n) => n.column).column + 1 - vm.hiddenColumns;
      vm.numRows = vm.perksOnly ? 2 : _.max(visibleNodes, (n) => n.row).row + 1;
    }
  };
开发者ID:bhollis,项目名称:DIM,代码行数:17,代码来源:talent-grid.component.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript underscore.findIndex函数代码示例发布时间:2022-05-25
下一篇:
TypeScript underscore.filter函数代码示例发布时间: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