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

TypeScript underscore.findWhere函数代码示例

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

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



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

示例1: it

    it('DAY_AFTER_NIGHT - после того как все проснулись и узнали кого убили, необходимо удалить этого игрока из партии, сменить статус', () => {
        let token_1 = 'wef43f',
            players: Array<GamePlayer> = [
                getGamePlayer({role: Roles.INHABITANT}),
                getGamePlayer({role: Roles.INHABITANT, token: token_1}),
                getGamePlayer({role: Roles.MAFIA}),
                getGamePlayer({role: Roles.DOCTOR})
            ],
            round_data = {
                    killed: [token_1]
            };

        status = GameStatus.DAY_AFTER_NIGHT;
        state =  GameStatusReducer(getGameStateAfterNight(round_data, players), GameAction.nextGameStep(status));

        expect(state.time_last_update).not.toBeLessThan(now);
        expect(state.status).toEqual(status);
        expect(state.time_last_update_players).toBeLessThan(now);
        expect(_.findWhere(state.players, {token: token_1})).toBeUndefined();
    });
开发者ID:andreevWork,项目名称:mafia,代码行数:20,代码来源:GameStatusReducerTest.ts


示例2: it

    it('3 ночь приходит голос от мафии', (done) => {
        let unsubscribe;

        mafia_target = _.findWhere(store.getState().players, {role: Roles.INHABITANT}).token;

        unsubscribe = store.subscribe(() => {
            expect(store.getState().status).toBe(GameStatus.VOTE_MAFIA);
            expect(store.getState().active_roles).toEqual([Roles.MAFIA]);
            expect(store.getState().vote_variants).toEqual(_.pluck(store.getState().players.filter(player => player.role !== Roles.MAFIA), 'token'));
            expect(store.getState().votes).toEqual([{who_token: mafia, for_whom_token: mafia_target}]);

            // Отписываемся т. к. store общий для всех тестов
            unsubscribe();
            done();
        });

        store.dispatch(GameAction.vote(
            mafia,
            mafia_target
        ));
    });
开发者ID:andreevWork,项目名称:mafia,代码行数:21,代码来源:FirstScenario.ts


示例3: build

  public async build(executionReport: IExecutionReport): Promise<{ container: Dom; gridOptions: agGridModule.GridOptions }> {
    const { container, agGridElement } = ExecutionReport.standardSectionHeader(this.sectionTitle);
    let gridOptions: agGridModule.GridOptions;
    const topLevelProperty = find(executionReport.children, child => {
      return child.name == this.topLevelProperty && child.children && findWhere(child.children, { name: this.secondLevelProperty });
    });

    if (topLevelProperty && topLevelProperty.children) {
      const secondLevelProperty = findWhere(topLevelProperty.children, { name: this.secondLevelProperty }) as
        | IExecutionReportSimpleSection
        | undefined;

      if (secondLevelProperty) {
        const dataSource = [
          {
            ...new ExecutionReportGenericSection().build(secondLevelProperty),
            ...{ Applied: new GenericValueOutput().output(secondLevelProperty.applied) }
          }
        ];

        const tableBuilder = await new TableBuilder().build(dataSource, agGridElement);
        gridOptions = tableBuilder.gridOptions;
      }
    } else {
      const tableBuilder = await new TableBuilder().build(
        [
          {
            [`${this.sectionTitle}`]: {
              content: `NO DATA AVAILABLE FOR ${this.sectionTitle} IN CURRENT EXECUTION REPORT`
            }
          }
        ],
        agGridElement
      );

      gridOptions = tableBuilder.gridOptions;
    }

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


示例4: fillCache

    fillCache(20, numMRRTTokens, false, function(err: any, testValues: any) {
      var responses = testValues.cachedResponses;
      var memCache = testValues.memCache;
      var fakeTokenRequest = testValues.fakeTokenRequest;

      var mrrtEntry: any = _.findWhere(memCache._entries, { isMRRT : true });

      if (!err) {
        compareInputAndCache(responses, memCache, numMRRTTokens);

        var cacheDriver = new CacheDriver(fakeTokenRequest._callContext, cp.authorityTenant, mrrtEntry.resource, mrrtEntry._clientId, memCache, unexpectedRefreshFunction);
        cacheDriver.find({}, function(err: any, entry: any) {
          if (!err) {
            assert(entry, 'Find did not return any entry');
            assertEntriesEqual(mrrtEntry, entry, 'Queried entry did not match expected: ' + JSON.stringify(entry));
          }
          done(err);
          return;
        });
      } else {
        done(err);
        return;
      }
    });
开发者ID:AzureAD,项目名称:azure-activedirectory-library-for-nodejs,代码行数:24,代码来源:cache-driver.ts


示例5: Number

 vm.lockedperks[type] = _.omit(perkMap, (_perk, perkHash) => {
   return _.findWhere(vendorPerks[vm.active][type], { hash: Number(perkHash) });
 });
开发者ID:bhollis,项目名称:DIM,代码行数:3,代码来源:loadout-builder.component.ts


示例6: alreadyExists

 function alreadyExists(set: D1Item[], id: string) {
   return _.findWhere(set, { id }) || _.findWhere(set, { index: id });
 }
开发者ID:bhollis,项目名称:DIM,代码行数:3,代码来源:loadout-builder.component.ts


示例7: getGameStatus

function getGameStatus(rs: RootState, game: Game, caveId?: string): GameStatus {
  const { commons, tasks, downloads } = rs;
  const { profile } = rs.profile;

  let downloadKeys = getByIds(
    commons.downloadKeys,
    commons.downloadKeyIdsByGameId[game.id]
  );

  let cave: CaveSummary;
  let numCaves = 0;
  if (!cave) {
    if (caveId) {
      cave = commons.caves[caveId];
    } else {
      let caves = getByIds(commons.caves, commons.caveIdsByGameId[game.id]);
      numCaves = size(caves);
      cave = first(caves);
    }
  }
  const downloadKey = first(downloadKeys);

  const pressUser = profile.user.pressUser;
  const task = first(tasks.tasksByGameId[game.id]);

  const pendingDownloads = getPendingForGame(downloads, game.id);
  let download: Download;
  if (caveId) {
    download = findWhere(pendingDownloads, { caveId });
  } else {
    download = first(pendingDownloads);
  }

  let isActiveDownload = false;
  let areDownloadsPaused = false;
  let downloadProgress: DownloadProgress;
  if (download) {
    const activeDownload = getActiveDownload(downloads);
    isActiveDownload = download.id === activeDownload.id;
    areDownloadsPaused = downloads.paused;
    downloadProgress = downloads.progresses[download.id];
  }

  let update: GameUpdate;
  if (cave) {
    update = rs.gameUpdates.updates[cave.id];
  }

  const profileId = profile.id;

  return realGetGameStatus(
    game,
    cave,
    numCaves,
    downloadKey,
    pressUser,
    task,
    download,
    downloadProgress,
    update,
    isActiveDownload,
    areDownloadsPaused,
    profileId
  );
}
开发者ID:itchio,项目名称:itch,代码行数:65,代码来源:get-game-status.ts


示例8: getKonteynerById

 getKonteynerById(id: number): IKonteyner {
     return _.findWhere(this.bkgModel.konteynerlar, { id: id });
 }
开发者ID:jmptrader,项目名称:RotaTsFramework,代码行数:3,代码来源:bkg.service.ts


示例9: type

 data.relationships[relationshipName].data.forEach((item: any) => {
     let relationship: any = _.findWhere(included, {id: item.id});
     relationshipList.push(new type(relationship));
 });
开发者ID:acramatte,项目名称:angular2-jsonapi,代码行数:4,代码来源:json-api.model.ts


示例10:

			_.each(results, (trigger) => {
				let o = _.findWhere(timeline, { id: trigger.id })
				if (o) {
					o.trigger.value = trigger.time
				}
			})
开发者ID:baltedewit,项目名称:tv-automation-state-timeline-resolver,代码行数:6,代码来源:conductor.spec.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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