當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。