本文整理匯總了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);
}
});
示例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);
}
});
示例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));
}
示例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 "";
}
示例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);
}
});
示例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.');
}
});
}
}
});
示例7: onToggleAlaCarte
onToggleAlaCarte(alaCarteId: string) {
if(_.contains(this.selectedAlaCarteIds, alaCarteId)){
this.selectedAlaCarteIds =
_.without(this.selectedAlaCarteIds, alaCarteId);
} else {
this.selectedAlaCarteIds.push(alaCarteId);
}
}
示例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);
}
}