當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript lodash.indexOf函數代碼示例

本文整理匯總了TypeScript中lodash.indexOf函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript indexOf函數的具體用法?TypeScript indexOf怎麽用?TypeScript indexOf使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了indexOf函數的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: removeSelectPart

  removeSelectPart(selectParts, part) {
    // if we remove the field remove the whole statement
    if (part.def.type === 'field') {
      if (this.selectModels.length > 1) {
        var modelsIndex = _.indexOf(this.selectModels, selectParts);
        this.selectModels.splice(modelsIndex, 1);
      }
    } else {
      var partIndex = _.indexOf(selectParts, part);
      selectParts.splice(partIndex, 1);
    }

    this.updatePersistedParts();
  }
開發者ID:Backdash,項目名稱:grafana,代碼行數:14,代碼來源:influx_query.ts

示例2: switch

 _.forEach(commands, c => {
   switch (c.type) {
     case 'r':
       const a = Number(c.args[0]);
       if (Math.random() > 1 / a) {
         isCondMatched = false;
         return false;
       }
       break;
     case 'c':
       let count = 0;
       for (let y = 0; y < 3; y++) {
         for (let x = 0; x < 3; x++) {
           const rc = rule.before[y][x];
           const cl = getCell(sx + x, sy + y);
           if (rc === ' ' && cl != null && _.indexOf(c.args[1], cl) >= 0) {
             count++;
           }
         }
       }
       if (count !== Number(c.args[0])) {
         isCondMatched = false;
         return false;
       }
       break;
   }
 });
開發者ID:abagames,項目名稱:consomaton-game-lib,代碼行數:27,代碼來源:automaton.ts

示例3: filterByTag

 filterByTag(tag) {
   if (_.indexOf(this.query.tag, tag) === -1) {
     this.query.tag.push(tag);
     this.search();
     this.giveSearchFocus = this.giveSearchFocus + 1;
   }
 }
開發者ID:arcolife,項目名稱:grafana,代碼行數:7,代碼來源:search.ts

示例4: inRow

export function inRow(solid: string, sectionName: string, rowName: string) {
  const { rows, data } = sections[sectionName];
  const rowIndex = _.indexOf(rows, rowName);
  const row = data[rowIndex];
  // TODO deal with '!' stuff in tables
  return hasDeep(row, toConwayNotation(solid));
}
開發者ID:tessenate,項目名稱:polyhedra-viewer,代碼行數:7,代碼來源:tableUtils.ts

示例5: search

  // 쿼리 전송
  public search(type: string, query: any, options): Promise<any> {
    if (!_.isUndefined(query.resultFormat)) {
      query.resultFormat.mode = _.indexOf(pivotChart, type.toString()) > -1 ? type : ChartType.BAR;
      query.resultFormat.options = _.extend({}, { addMinMax: true }, options);
    }

    return this.post(this.API_URL + 'datasources/query/search', query);
  }
開發者ID:bchin22,項目名稱:metatron-discovery,代碼行數:9,代碼來源:chart-test.service.ts

示例6: function

 _.each(options, function(value, key) {
   if (_.indexOf(graphite_options, key) === -1) {
     return;
   }
   if (value) {
     clean_options.push(key + '=' + encodeURIComponent(value));
   }
 });
開發者ID:GPegel,項目名稱:grafana,代碼行數:8,代碼來源:datasource.ts

示例7: function

 _.each(original.vuosiluokkakokonaisuudet, function(vlk) {
     if (_.indexOf(removedVlkSet, "" + vlk._vuosiluokkaKokonaisuus) > -1) {
         promises.push(
             PerusopetusService.deleteOppiaineenVuosiluokkakokonaisuus(vlk, $scope.editableModel.id)
                 .$promise
         );
     }
 });
開發者ID:Opetushallitus,項目名稱:eperusteet,代碼行數:8,代碼來源:oppiaine.ts

示例8: moveRow

  moveRow(direction) {
    var rowsList = this.dashboard.rows;
    var rowIndex = _.indexOf(rowsList, this.row);
    var newIndex = rowIndex + direction;

    if (newIndex >= 0 && newIndex <= (rowsList.length - 1)) {
      _.move(rowsList, rowIndex, newIndex);
    }
  }
開發者ID:PaulMest,項目名稱:grafana,代碼行數:9,代碼來源:row_ctrl.ts

示例9:

                    response: response => {
                        const uudelleenohjausStatuskoodit = [401, 412, 500];
                        const fail = _.indexOf(uudelleenohjausStatuskoodit, response.status) !== -1;

                        if (fail) {
                            $rootScope.$emit("event:uudelleenohjattava", response.status);
                        }
                        return response || $q.when(response);
                    },
開發者ID:Opetushallitus,項目名稱:eperusteet,代碼行數:9,代碼來源:app.ts


注:本文中的lodash.indexOf函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。