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


TypeScript underscore.contains函數代碼示例

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


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

示例1: assert

        this._activateSession(internalSession, (err: Error | null /*, newSession?: ClientSessionImpl*/) => {
            if (!err) {

                if (old_client !== this) {
                    // remove session from old client:
                    if (old_client) {
                        old_client._removeSession(internalSession);
                        assert(!_.contains(old_client._sessions, internalSession));
                    }

                    this._addSession(internalSession);
                    assert(internalSession._client === this);
                    assert(!internalSession._closed, "session should not vbe closed");
                    assert(_.contains(this._sessions, internalSession));
                }
                callback();

            } else {

                // istanbul ignore next
                if (doDebug) {
                    debugLog(chalk.red.bgWhite("reactivateSession has failed !"), err.message);
                }
                callback(err);
            }
        });
開發者ID:node-opcua,項目名稱:node-opcua,代碼行數:26,代碼來源:opcua_client_impl.ts

示例2: function

                        angular.forEach(row, function (val:any, name:any) {
                            var displayName = name;
                            if (name.indexOf('.') >= 0) {
                                displayName = name.substring(name.indexOf('.') + 1);
                            }
                            if (hideColumns && (_.contains(hideColumns, displayName) || _.contains(hideColumns, name))) {

                            }
                            else {
                                displayColumns.push(displayName)
                                columns.push(name);
                            }
                        });
開發者ID:prashanthc97,項目名稱:kylo,代碼行數:13,代碼來源:HiveService.ts

示例3: _removeSession

    public _removeSession(session: ClientSessionImpl) {

        const index = this._sessions.indexOf(session);

        if (index >= 0) {
            const s = this._sessions.splice(index, 1)[0];
            assert(s === session);
            assert(!_.contains(this._sessions, session));
            assert(session._client === this);
            session._client = null;
        }
        assert(!_.contains(this._sessions, session));
    }
開發者ID:node-opcua,項目名稱:node-opcua,代碼行數:13,代碼來源:client_base_impl.ts

示例4: validateTeam

	private static validateTeam(days: Date[], team: TeamModel, daysOfWeek: string[]): string {
		for (let byeDay of team.byes) {
			if (!_.contains(days, byeDay)) {
				return "Team " + team.teamName + " requested bye " + 
					DateUtils.niceStringForDate(byeDay) + 
					", but that is not a day when games are scheduled.";
			}
		}
		if (team.badDayOfWeek && !_.contains(daysOfWeek, team.badDayOfWeek.toLowerCase())) {
			return "Team " + team.teamName + " asked for no games on " + 
				team.badDayOfWeek + "s, but that is not a day of the week when games on scheduled.";
		}
		return "";
	}
開發者ID:dlev-,項目名稱:LeagueScheduler,代碼行數:14,代碼來源:ScheduleValidator.ts

示例5: each

      each(indexQuerySection.result.in, (paramValue: string, paramKey: string) => {
        const row = $$('tr');
        table.append(row.el);

        const id = `executionReportIndexExecution${paramKey}`;

        if (contains(collapsibleSectionsInReport, paramKey) && paramValue) {
          const btn = $$(
            'button',
            {
              className: 'coveo-button'
            },
            paramKey
          );

          const tdTarget = $$(
            'td',
            {
              id,
              className: 'coveo-relevance-inspector-effective-query-collapsible'
            },
            new GenericValueOutput().output(paramValue).content
          );

          btn.on('click', () => {
            tdTarget.toggleClass('coveo-active');
          });

          row.append($$('td', undefined, btn).el);
          row.append(tdTarget.el);
        } else {
          row.append($$('td', undefined, paramKey).el);
          row.append($$('td', undefined, new GenericValueOutput().output(paramValue).content).el);
        }
      });
開發者ID:coveo,項目名稱:search-ui,代碼行數:35,代碼來源:ExecutionReportEffectiveIndexQuerySection.ts

示例6: function

 storage.get('queries', function(error, queries) {
   if (error) {
     console.error(error);
   } else {
     if (_.contains(_.map(queries, (q: QueryEntry) => { return q.name; }), $name.val())) {
       pushResponse($resp, 'Key already exists.');
     } else {
       if (_.isEmpty(queries)) {
         queries = [];
       }
       queries.push({
         name: $name.val(),
         collection: $collection.val(),
         query: $query.val()
       });
       storage.set('queries', queries, function(error) {
         if (error) {
           console.error(error);
         } else {
           pushResponse($resp, 'Entry added successfully.');
         }
       });
     }
   }
 });
開發者ID:hack-rpi,項目名稱:Email-Board,代碼行數:25,代碼來源:query-dialog.ts

示例7: onToggleAlaCarte

 onToggleAlaCarte(alaCarteId: string) {
   if(_.contains(this.selectedAlaCarteIds, alaCarteId)){
     this.selectedAlaCarteIds = 
       _.without(this.selectedAlaCarteIds, alaCarteId);
   } else {
     this.selectedAlaCarteIds.push(alaCarteId);
   }
 }
開發者ID:SkillitCooking,項目名稱:app1.0,代碼行數:8,代碼來源:cook-select.ts

示例8: update

 /**
  * Update the contents of this view
  *
  * Called when the model is changed.  The model may have been
  * changed by another view or by a state update from the back-end.
  */
 update() {
     super.update();
     var selected = this.model.get('value') || [];
     var values = _.map(selected, encodeURIComponent);
     var options = this.listbox.options;
     for (var i = 0, len = options.length; i < len; ++i) {
         var value = options[i].getAttribute('data-value');
         options[i].selected = _.contains(values, value);
     }
 }
開發者ID:dmadeka,項目名稱:ipywidgets,代碼行數:16,代碼來源:widget_selection.ts


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