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

TypeScript underscore.where函数代码示例

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

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



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

示例1:

    const mapData = _.map(labels, (label) => {
      if (vm.item.destinyVersion === 1) {
        const matchingReviews = _.where(itemReviews, { rating: label });
        const highlightedReviews = _.where(matchingReviews, { isHighlighted: true });

        return matchingReviews.length + highlightedReviews.length * 4;
      } else {
        const highlightedReviews = itemReviews.filter((review) => review.isHighlighted);
        return itemReviews.length + highlightedReviews.length * 4;
      }
    });
开发者ID:bhollis,项目名称:DIM,代码行数:11,代码来源:item-review.component.ts


示例2: getPerkNodesInColumn

function getPerkNodesInColumn(item: D1Item, column): D1GridNode[] {
  if (!item.talentGrid) {
    return [];
  }

  return _.where(item.talentGrid.nodes, { column });
}
开发者ID:bhollis,项目名称:DIM,代码行数:7,代码来源:perkRater.ts


示例3: function

		selection: function(){
			//returning the new array systematically breaks the watcher
			//due to the reference always being updated
			var currentSelection = _.where(this.all, { selected: true }) || [];
			if(!this._selection || this._selection.length !== currentSelection.length){
				this._selection = currentSelection;
			}
			return this._selection;
		},
开发者ID:entcore,项目名称:infra-front,代码行数:9,代码来源:lib.ts


示例4:

 this.loadCredentials().then((entries) => {
     // Find the entry I want based on service
     let entryArray: Array<any> = _.where(entries, { service: service });
     if (entryArray !== undefined && entryArray.length > 0) {
         let credential: Credential = this.createCredential(entryArray[0]);
         deferred.resolve(credential);
     } else {
         deferred.resolve(undefined);
     }
 })
开发者ID:chrisdias,项目名称:vsts-vscode,代码行数:10,代码来源:linux-file-api.ts


示例5:

 .then((body2)=> { 
    var resultJson = JSON.parse(body2);
    var gameCount = +resultJson.response.game_count;
    var gameNotPlayed = +_.where(resultJson.response.games, {playtime_forever: 0}).length;
    var total = (gameNotPlayed/gameCount) *100;
    
    if(total > 60){
     return "You have more than enough games to play for now." 
    } else {
     return "Go ahead if you have the money."
    }
              
 })
开发者ID:DouglasPonce85,项目名称:acklen-slackbot,代码行数:13,代码来源:GamerBotHelper.ts


示例6: it

    it('2 ночь путана проголосует и это уже не имеет значения', (done) => {
        let unsubscribe;

        real_man = _.last(_.without(_.pluck(_.where(store.getState().players, {role: Roles.INHABITANT}), 'token'), mafia_target));

        unsubscribe = store.subscribe(() => {
            expect(store.getState().status).toBe(GameStatus.VOTE_WHORE);
            expect(store.getState().active_roles).toEqual([Roles.WHORE]);
            expect(store.getState().vote_variants).toEqual(_.pluck(store.getState().players.filter(player => player.token !== whore), 'token'));
            expect(store.getState().votes).toEqual([{who_token: whore, for_whom_token: real_man}]);

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

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


示例7: destroyWhere

 /**
  * Destroy all records matching criteria.
  * @see where
  * @param criteria
  * @returns {boolean}
  */
 destroyWhere(criteria) {
     var matches = _.where(this._rows, criteria);
     var newRows = _.difference(this._rows, matches);
     this._rows = newRows;
     return this.save();
 }
开发者ID:lorddoig,项目名称:lsdb,代码行数:12,代码来源:lsdb.ts


示例8: quickApplyBlocks

  async quickApplyBlocks(blocks:BlockDTO[], to: number): Promise<void> {

    sync_memoryDAL.sindexDAL = { getAvailableForConditions: (conditions:string) => this.dal.sindexDAL.getAvailableForConditions(conditions) }
    let blocksToSave: BlockDTO[] = [];

    for (const block of blocks) {
      sync_allBlocks.push(block);

      // The new kind of object stored
      const dto = BlockDTO.fromJSONObject(block)

      if (block.number == 0) {
        sync_currConf = BlockDTO.getConf(block);
      }

      if (block.number <= to - this.conf.forksize) {
        blocksToSave.push(dto);
        const index:any = Indexer.localIndex(dto, sync_currConf);
        const local_iindex = Indexer.iindex(index);
        const local_cindex = Indexer.cindex(index);
        const local_sindex = Indexer.sindex(index);
        const local_mindex = Indexer.mindex(index);

        const HEAD = await Indexer.quickCompleteGlobalScope(block, sync_currConf, sync_bindex, local_iindex, local_mindex, local_cindex, {
          getBlock: (number: number) => {
            return Promise.resolve(sync_allBlocks[number]);
          },
          getBlockByBlockstamp: (blockstamp: string) => {
            return Promise.resolve(sync_allBlocks[parseInt(blockstamp)]);
          }
        });
        sync_bindex.push(HEAD);

        // Remember expiration dates
        for (const entry of index) {
          if (entry.expires_on) {
            sync_expires.push(entry.expires_on)
          }
          if (entry.revokes_on) {
            sync_expires.push(entry.revokes_on)
          }
        }
        sync_expires = _.uniq(sync_expires);

        await this.blockchain.createNewcomers(local_iindex, this.dal, this.logger)

        if (block.dividend
          || block.joiners.length
          || block.actives.length
          || block.revoked.length
          || block.excluded.length
          || block.certifications.length
          || block.transactions.length
          || block.medianTime >= sync_nextExpiring) {
          const nextExpiringChanged = block.medianTime >= sync_nextExpiring

          for (let i = 0; i < sync_expires.length; i++) {
            let expire = sync_expires[i];
            if (block.medianTime >= expire) {
              sync_expires.splice(i, 1);
              i--;
            }
          }
          sync_nextExpiring = sync_expires.reduce((max, value) => max ? Math.min(max, value) : value, 9007199254740991); // Far far away date

          // Fills in correctly the SINDEX
          await Promise.all(_.where(sync_sindex.concat(local_sindex), { op: 'UPDATE' }).map(async (entry: any) => {
            if (!entry.conditions) {
              const src = await this.dal.sindexDAL.getSource(entry.identifier, entry.pos);
              entry.conditions = src.conditions;
            }
          }))

          // Flush the INDEX (not bindex, which is particular)
          await this.dal.mindexDAL.insertBatch(sync_mindex);
          await this.dal.iindexDAL.insertBatch(sync_iindex);
          await this.dal.sindexDAL.insertBatch(sync_sindex);
          await this.dal.cindexDAL.insertBatch(sync_cindex);
          sync_iindex = local_iindex
          sync_cindex = local_cindex
          sync_mindex = local_mindex
          sync_sindex = local_sindex

          sync_sindex = sync_sindex.concat(await Indexer.ruleIndexGenDividend(HEAD, local_iindex, this.dal));
          sync_sindex = sync_sindex.concat(await Indexer.ruleIndexGarbageSmallAccounts(HEAD, sync_sindex, sync_memoryDAL));
          if (nextExpiringChanged) {
            sync_cindex = sync_cindex.concat(await Indexer.ruleIndexGenCertificationExpiry(HEAD, this.dal));
            sync_mindex = sync_mindex.concat(await Indexer.ruleIndexGenMembershipExpiry(HEAD, this.dal));
            sync_iindex = sync_iindex.concat(await Indexer.ruleIndexGenExclusionByMembership(HEAD, sync_mindex, this.dal));
            sync_iindex = sync_iindex.concat(await Indexer.ruleIndexGenExclusionByCertificatons(HEAD, sync_cindex, local_iindex, this.conf, this.dal));
            sync_mindex = sync_mindex.concat(await Indexer.ruleIndexGenImplicitRevocation(HEAD, this.dal));
          }
          // Update balances with UD + local garbagings
          await this.blockchain.updateWallets(sync_sindex, sync_memoryDAL)

          // Flush the INDEX again (needs to be done *before* the update of wotb links because of block#0)
          await this.dal.iindexDAL.insertBatch(sync_iindex);
          await this.dal.mindexDAL.insertBatch(sync_mindex);
          await this.dal.sindexDAL.insertBatch(sync_sindex);
          await this.dal.cindexDAL.insertBatch(sync_cindex);
//.........这里部分代码省略.........
开发者ID:duniter,项目名称:duniter,代码行数:101,代码来源:QuickSync.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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