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


TypeScript lodash.has函数代码示例

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


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

示例1: return

 let funcs = _.filter(analyzeStack, (as) => {
     return (_.has(as, 'args'));
 });
开发者ID:OyeBenny,项目名称:sarad,代码行数:3,代码来源:interpreter.ts

示例2:

 var dimensionKey = _.findKey(target.dimensions, v => {
   return templateSrv.variableExists(v) && !_.has(scopedVars, templateSrv.getVariableName(v));
 });
开发者ID:ilgizar,项目名称:grafana,代码行数:3,代码来源:datasource.ts

示例3:

 return player => _.has(player, 'nickname') && re.test(player.nickname);
开发者ID:bgotink,项目名称:IngressIdentity,代码行数:1,代码来源:finder.ts

示例4: isEvent

 static isEvent(proto: any): proto is Event {
   return _.has(proto, "context") && _.has(proto, "data");
 }
开发者ID:firebase,项目名称:firebase-tools,代码行数:3,代码来源:types.ts

示例5:

 (uiData) => uiData && _.has(uiData, VERSION_DISMISSED_KEY),
开发者ID:boreys,项目名称:cockroach,代码行数:1,代码来源:alerts.ts

示例6:

 .reduce((acc: IInstanceCounts, instance: any) => {
   if (has(instance, 'health.state')) {
     acc[camelCase(instance.health.state)]++;
   }
   return acc;
 }, {up: 0, down: 0, outOfService: 0, succeeded: 0, failed: 0, starting: 0, unknown: 0}).value();
开发者ID:jcwest,项目名称:deck,代码行数:6,代码来源:transformer.ts

示例7: function

 _.each(tavoitteet, function(tavoite) {
     if (!tavoite.pakollinen && tavoite._esitieto && _.has(groups.grouped, tavoite._esitieto)) {
         groups.grouped[tavoite._esitieto].push(tavoite);
         processed.push(tavoite);
     }
 });
开发者ID:Opetushallitus,项目名称:eperusteet,代码行数:6,代码来源:tutke2osa.ts

示例8: createPlayer

export default function createPlayer(manifestEntry: ManifestEntry, sourceEntry: SourceEntry): Player {
  let {
    faction, extraData
  } = manifestEntry;

  let {
    oid,

    name,
    nickname,
    level,
    errors,

    extraData: sourceExtraData
  } = sourceEntry;

  const player: Player = {
    oid,
    faction,
    level,

    nickname,
    name,

    anomaly: [],
    community: [],
    event: [],

    sources: [],

    errors,
  };

  if (_.has(sourceExtraData, 'faction')) {
    player.faction = parseFaction(sourceExtraData['faction']);
    sourceExtraData = _.omit<ExtraData, ExtraData>(sourceExtraData, 'faction');
  }

  let extra = _.merge({} as ExtraData, extraData, sourceExtraData);

  const community = extractCommunityOrEvent('community', extra);
  if (community != null) {
    player.community.push(community);
  }

  const event = extractCommunityOrEvent('event', extra);
  if (event != null) {
    player.event.push(event);
  }

  if (_.has(extra, 'anomaly')) {
    if (isValidAnomaly(extra['anomaly'])) {
      player.anomaly.push(parseAnomaly(extra['anomaly']));
    } else {
      player.errors.push(`Unknown anomaly: "${extra['anomaly']}"`);
    }

    delete extra['anomaly'];
  }

  if (!_.isEmpty(extra)) {
    player.extra = mapExtra(extra);
  }
  
  return player;
}
开发者ID:bgotink,项目名称:IngressIdentity,代码行数:66,代码来源:interpreter.ts

示例9:

export function isLeaf<T>(t: TreeNode<T>): boolean {
  return !_.has(t, "children");
}
开发者ID:a6802739,项目名称:cockroach,代码行数:3,代码来源:tree.ts

示例10: Error

  selectionSet.selections.forEach((selection) => {
    if (selection.kind !== 'Field') {
       throw new Error('Only fields supported so far, not fragments.');
    }

    const field = selection as Field;

    const storeFieldKey = storeKeyNameFromField(field, variables);
    const resultFieldKey = resultKeyNameFromField(field);

    if (! has(storeObj, storeFieldKey)) {
      if (throwOnMissingField) {
        throw new Error(`Can't find field ${storeFieldKey} on object ${storeObj}.`);
      }

      missingSelections.push(field);

      return;
    }

    const storeValue = storeObj[storeFieldKey];

    if (! field.selectionSet) {
      result[resultFieldKey] = storeValue;
      return;
    }

    if (isNull(storeValue)) {
      // Basically any field in a GraphQL response can be null
      result[resultFieldKey] = null;
      return;
    }

    if (isArray(storeValue)) {
      result[resultFieldKey] = storeValue.map((id) => {
        const itemDiffResult = diffSelectionSetAgainstStore({
          store,
          throwOnMissingField,
          rootId: id,
          selectionSet: field.selectionSet,
          variables,
        });

        itemDiffResult.missingSelectionSets.forEach(
          itemSelectionSet => missingSelectionSets.push(itemSelectionSet));
        return itemDiffResult.result;
      });
      return;
    }

    if (isString(storeValue)) {
      const subObjDiffResult = diffSelectionSetAgainstStore({
        store,
        throwOnMissingField,
        rootId: storeValue,
        selectionSet: field.selectionSet,
        variables,
      });

      // This is a nested query
      subObjDiffResult.missingSelectionSets.forEach(
        subObjSelectionSet => missingSelectionSets.push(subObjSelectionSet));

      result[resultFieldKey] = subObjDiffResult.result;
      return;
    }

    throw new Error('Unexpected number value in the store where the query had a subselection.');
  });
开发者ID:johnthepink,项目名称:apollo-client,代码行数:69,代码来源:diffAgainstStore.ts


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