本文整理汇总了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);
}
}