当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript underscore.size函数代码示例

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


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

示例1: dataStats

export function dataStats(data) {
  const taggedItemsD1 = sum(
    Object.keys(data)
      .filter((k) => k.startsWith('dimItemInfo') && k.endsWith('-d1'))
      .map((k) => _.size(data[k])),
    (v) => v
  );
  const taggedItemsD2 = sum(
    Object.keys(data)
      .filter((k) => k.startsWith('dimItemInfo') && k.endsWith('-d2'))
      .map((k) => _.size(data[k])),
    (v) => v
  );

  const loadoutsD1 = count(
    data['loadouts-v3.0'] || [],
    (loadoutId: string) => data[loadoutId] && data[loadoutId].destinyVersion !== 2
  );
  const loadoutsD2 = count(
    data['loadouts-v3.0'] || [],
    (loadoutId: string) => data[loadoutId] && data[loadoutId].destinyVersion === 2
  );

  return {
    LoadoutsD1: loadoutsD1,
    LoadoutsD2: loadoutsD2,
    TagNotesD1: taggedItemsD1,
    TagNotesD2: taggedItemsD2,
    Settings: _.size(data['settings-v1.0']),
    IgnoredUsers: _.size(data.ignoredUsers)
  };
}
开发者ID:bhollis,项目名称:DIM,代码行数:32,代码来源:data-stats.ts

示例2: function

    this.us.getUsers().subscribe(users => {
      let participants: number [] = [0, 0, 0, 0];
      participants[0] = _.size(_.filter(users, function(user){ return +user.job === 1; }));
      participants[1] =  _.size(_.filter(users, function(user){ return +user.job === 2; }));
      participants[2] =  _.size(_.filter(users, function(user){ return +user.job === 3; }));
      participants[3] = _.size(_.filter(users, function(user){ return +user.job === 4; }));
      this.chart.data = participants;

    });
开发者ID:achillesimo,项目名称:sondage,代码行数:9,代码来源:doughnut.component.ts

示例3: dataStats

  function dataStats(data) {
    const taggedItems = sum(Object.keys(data)
                            .filter((k) => k.startsWith('dimItemInfo'))
                            .map((k) => _.size(data[k])), (v) => v);

    return {
      Loadouts: _.size(data['loadouts-v3.0']),
      TagNotes: taggedItems,
      Settings: _.size(data['settings-v1.0']),
      IgnoredUsers: _.size(data.ignoredUsers)
    };
  }
开发者ID:delphiactual,项目名称:DIM,代码行数:12,代码来源:storage.component.ts

示例4: getLastLevel

	private getLastLevel(type) {
		let numLevels = _.size(this.levels);
		if(numLevels != 0) {
			let lastLevel = this.levels[numLevels-1];
			return lastLevel[type];
		} else {
			return null;
		}
	}
开发者ID:openevocracy,项目名称:openevocracy,代码行数:9,代码来源:topiclist-element.ts

示例5: Error

  .then((response) => {
    // TODO: what does it actually look like to not have an account?
    if (_.size(response.Response) === 0) {
      throw new Error(t('BungieService.NoAccountForPlatform', {
        platform: platform.platformLabel
      }));
    }

    return response.Response;
  }) as IPromise<DestinyProfileResponse>;
开发者ID:delphiactual,项目名称:DIM,代码行数:10,代码来源:destiny2-api.ts

示例6:

			.switchMap(term => {
				var temp;
				var trimmed = term.toString().trim();

				if (_.size(trimmed) > 0) {
					temp = this.rawSearch(trimmed);
				} else {
					temp = Observable.of([]);
				}
				return temp;
			});
开发者ID:woollyblanket,项目名称:supa-client,代码行数:11,代码来源:results.service.ts

示例7: function

    this.vs.getVotes().subscribe(votes => {
      let satisfactions: number [] = [0, 0, 0, 0];
      satisfactions[0] = _.size(_.filter(votes, function(vote){ return +vote.satisfaction === 0; }));
      satisfactions[1] = _.size(_.filter(votes, function(vote){ return +vote.satisfaction === 25; }));
      satisfactions[2] = _.size(_.filter(votes, function(vote){ return +vote.satisfaction === 50; }));
      satisfactions[3] = _.size(_.filter(votes, function(vote){ return +vote.satisfaction === 75; }));
      satisfactions[4] = _.size(_.filter(votes, function(vote){ return +vote.satisfaction === 100; }));

      let data = {
        data: satisfactions,
        label: 'Satisfaction globale',
        backgroundColor: [
          'rgba(255, 0, 0, 0.2)'
        ],
        borderColor: [
          'rgba(255,99,132,1)'
        ],
        borderWidth: 1
      };
      this.chart.data = [data];

    });
开发者ID:achillesimo,项目名称:sondage,代码行数:22,代码来源:bar.component.ts

示例8: trimHistory

export function trimHistory(ti: TabInstance): TabInstance {
  if (!ti || !ti.history) {
    return ti;
  }

  const historySize = size(ti.history);
  if (historySize <= maxHistorySize) {
    return ti;
  }

  let offset = maxHistorySize - historySize;
  let newIndex = ti.currentIndex - offset;
  let newHistory = ti.history.slice(offset);
  if (newIndex < 0 || newIndex >= size(newHistory)) {
    newIndex = size(newHistory) - 1;
  }

  return {
    ...ti,
    currentIndex: newIndex,
    history: newHistory,
  };
}
开发者ID:itchio,项目名称:itch,代码行数:23,代码来源:index.ts

示例9: processBnetCharactersRequest

  function processBnetCharactersRequest(response) {
    if (!response.data || _.size(response.data.Response) === 0) {
      throw error(t('BungieService.NoAccountForPlatform', {
        platform: platform.label
      }), 1601);
    }

    return _.map(response.data.Response.data.characters, (c: any) => {
      c.inventory = response.data.Response.data.inventory;

      return {
        id: c.characterBase.characterId,
        base: c
      };
    });
  }
开发者ID:delphiactual,项目名称:DIM,代码行数:16,代码来源:destiny1-api.ts

示例10:

function getByIds<T>(records: RecordMap<T>, ids: string[] | number[]): T[] {
  if (size(ids) === 0) {
    return emptyArr;
  }

  if (!records) {
    return emptyArr;
  }

  const result = [];
  for (const id of ids) {
    const record = records[id];
    if (record) {
      result.push(record);
    }
  }
  return result;
}
开发者ID:itchio,项目名称:itch,代码行数:18,代码来源:get-by-ids.ts


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