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

TypeScript underscore.intersection函数代码示例

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

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



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

示例1: getItemYear

function getItemYear(item) {
  // determine what year this item came from based on sourceHash value
  // items will hopefully be tagged as follows
  // No value: Vanilla, Crota's End, House of Wolves
  // The Taken King (year 2): 460228854
  // Rise of Iron (year 3): 24296771

  // This could be further refined for CE/HoW based on activity. See
  // DestinyRewardSourceDefinition and filter on %SOURCE%
  // if sourceHash doesn't contain these values, we assume they came from
  // year 1

  let year = 1;
  const ttk = item.sourceHashes.includes(yearHashes.year2[0]);
  const roi = item.sourceHashes.includes(yearHashes.year3[0]);
  if (ttk || item.infusable || _.intersection(yearHashes.year2, item.sourceHashes).length) {
    year = 2;
  }
  if (
    !ttk &&
    (item.classified || roi || _.intersection(yearHashes.year3, item.sourceHashes).length)
  ) {
    year = 3;
  }

  return year;
}
开发者ID:bhollis,项目名称:DIM,代码行数:27,代码来源:d1-item-factory.service.ts


示例2: it

    it("should return 7 refs for browseNode on ServerStatus (BrowseDirection.Both)", (done: any) => {

        const serverStatus = rootFolder.objects.server.serverStatus;

        const references = serverStatus.browseNode({
            browseDirection: BrowseDirection.Both,
            includeSubtypes: true,
            nodeClassMask: 0, // 0 = all nodes
            referenceTypeId: "HierarchicalReferences",
            resultMask: 0x3F
        });

        const browseNames = references.map((r) => r.browseName.name);

        // xx console.log("              " + browseNames.join(" , "));

        const expectedBrowseNames = [
            "StartTime", "CurrentTime", "State", "BuildInfo", "SecondsTillShutdown", "ShutdownReason", "Server"];
        _.intersection(browseNames, expectedBrowseNames).length.should.eql(expectedBrowseNames.length);

        redirectToFile("ReferenceDescription2.log", () => {
            _.isArray(references).should.eql(true);
            dumpReferenceDescriptions(addressSpace, references);
        }, done);

    });
开发者ID:node-opcua,项目名称:node-opcua,代码行数:26,代码来源:test_referencetype.ts


示例3: redirectToFile

      (done: any) => {

          const serverStatus = rootFolder.objects.server.serverStatus;

          const references = serverStatus.browseNode({
              browseDirection: BrowseDirection.Inverse,
              includeSubtypes: true,
              nodeClassMask: 0, // 0 = all nodes
              referenceTypeId: "HierarchicalReferences",
              resultMask: 0x3F
          });

          const browseNames = references.map((r: ReferenceDescription) => {
              return r.browseName!.name;
          });
          // console.log("             browseNames :  " + browseNames.join(" , "));

          // xx references.length.should.equal(7);
          const expectedBrowseNames = ["Server"];
          _.intersection(browseNames, expectedBrowseNames).length.should.eql(expectedBrowseNames.length);

          redirectToFile("ReferenceDescription1.log", () => {
              _.isArray(references).should.eql(true);
              dumpReferenceDescriptions(addressSpace, references);
          }, done);
      });
开发者ID:node-opcua,项目名称:node-opcua,代码行数:26,代码来源:test_referencetype.ts


示例4: isTextPresentInFeature

function isTextPresentInFeature(searchContext: ISearchContext, feature: IFeature): IFeature {
  const tagsScenariosMap = _.map(searchContext.tags, t => isTagPresentInFeature(t, feature));

  if (_.any(tagsScenariosMap, a => a === null)) {
    return null;
  }

  const tagsScenarios = _.union(...tagsScenariosMap);

  const isTextPresentInTitle = isTextPresent(searchContext, feature.Feature.Name);

  const isTextPresentInDescription = isTextPresent(searchContext, feature.Feature.Description);

  const isTextPresentInBackground = feature.Feature.Background &&
    isTextPresentInScenario(searchContext, feature.Feature.Background);

  // Intersection is made to preserve original order between scenarios
  let scenarios = !_.any(searchContext.tags)
    ? feature.Feature.FeatureElements : _.intersection(feature.Feature.FeatureElements, tagsScenarios);

  scenarios = _.filter(scenarios, s => isTextPresentInScenario(searchContext, s));
  if (!isTextPresentInTitle && !isTextPresentInDescription && !isTextPresentInBackground && !_.any(scenarios)) {
    return null;
  }

  return {
    Feature: {
      Background: !isTextPresentInBackground ? null : feature.Feature.Background,
      Description: feature.Feature.Description,
      FeatureElements: scenarios,
      Name: feature.Feature.Name,
      Result: feature.Feature.Result,
      Tags: feature.Feature.Tags
    },
    RelativeFolder: feature.RelativeFolder,
    code: feature.code,
    get isExpanded() { return feature.isExpanded; },
    set isExpanded(value: boolean) { feature.isExpanded = value; },
    isManual: feature.isManual
  };
}
开发者ID:eugene-sea,项目名称:LivingDocumentation,代码行数:41,代码来源:search.service.ts


示例5:

 return this.graph.filter(s => s['@type'] === 'rdf:Property' && s.domain && _.intersection(s.domain, conceptIDs).length > 0);
开发者ID:solars,项目名称:schemaorg-jsonld,代码行数:1,代码来源:schema.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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