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

TypeScript lodash.has函数代码示例

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

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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