本文整理汇总了TypeScript中underscore.without函数的典型用法代码示例。如果您正苦于以下问题:TypeScript without函数的具体用法?TypeScript without怎么用?TypeScript without使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了without函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
events.forEach(function(e){
var eventName = e.trim();
if(!that.callbacks){
that.callbacks = {};
}
if(!that.callbacks[eventName]){
that.callbacks[eventName] = [];
}
if(!cb){
that.callbacks[eventName].pop();
}
else{
that.callbacks[eventName] = _.without(
that.callbacks[eventName], _.find(
that.callbacks[eventName], function(item){
return item.toString() === cb.toString()
}
)
);
}
var propertiesChain = eventName.split('.');
if(propertiesChain.length > 1){
var prop = propertiesChain[0];
propertiesChain.splice(0, 1);
if(!this[prop] || !this[prop].on){
throw "Property " + prop + " is undefined in " + eventName;
}
this[prop].unbind(propertiesChain.join('.'));
}
}.bind(this));
示例2: onToggleAlaCarte
onToggleAlaCarte(alaCarteId: string) {
if(_.contains(this.selectedAlaCarteIds, alaCarteId)){
this.selectedAlaCarteIds =
_.without(this.selectedAlaCarteIds, alaCarteId);
} else {
this.selectedAlaCarteIds.push(alaCarteId);
}
}
示例3: expect
unsubscribe = store.subscribe(() => {
expect(store.getState().status).toBe(GameStatus.VOTE_DOCTOR);
expect(store.getState().active_roles).toEqual([Roles.DOCTOR]);
expect(store.getState().vote_variants).toEqual(_.without(_.pluck(store.getState().players, 'token'), store.getState().prev_round_healing));
expect(store.getState().votes).toEqual([{who_token: doctor, for_whom_token: healing}]);
// Отписываемся т. к. store общий для всех тестов
unsubscribe();
done();
});
示例4: destroy
/**
* Destroy a record based on it's unique key
* @param id - the unique identifier value to locate the record
* @param uniqueKey - the unique identifier field name e.g. 'id'
* @returns {boolean}
*/
destroy(id, uniqueKey:string = this._defaultUniqueKey) {
var criteria = {};
criteria[uniqueKey] = id;
var match = _.findWhere(this._rows, criteria);
if (match) {
this._rows = _.without(this._rows, match);
return this.save();
} else {
return false;
}
}
示例5: sendLike
sendLike(idPost, l, n) {
let checkUser: Boolean;
let idUser = Meteor.userId();
if (l.length === 0) {
checkUser = false;
} else {
for (let i = 0; i < l.length; i++) {
checkUser = idUser === _.property('idUser')(l[i]);
if (checkUser === true) {
break;
}
}
}
let name = Meteor.users.findOne(Meteor.userId()).profile.name;
if (checkUser === false) {
l.push({
idUser: idUser,
name: name,
});
Meteor.call('simpanTimeLine', {
dateTime: new Date(),
status: 'like',
message: `${name} likes ${n}'s post`
}, (error) => {
if (error) {
console.log(error);
}
});
} else {
l = _.without(l, _.findWhere(l, {
idUser: Meteor.userId(),
name: name,
}));
}
Posts.update(
{
_id: idPost
}, {
$set: {
likes: l
}
}
);
}
示例6: doUpdate
/**
* Internal method used to actually perform updates.
* @private
* @param rowAttrs
* @param save
* @param uniqueKey
* @returns {boolean}
*/
private doUpdate(rowAttrs:any, save?:boolean, uniqueKey:string = this._defaultUniqueKey) {
var toUpdate = this.deepClone(rowAttrs);
var criteria = {};
var record;
criteria[uniqueKey] = toUpdate[uniqueKey];
record = _.findWhere(this._rows, criteria);
if (_.isEmpty(record)) return false;
var updatedRecord = this.merge(record, toUpdate);
var rows = _.without(this._rows, record);
rows.push(updatedRecord);
this._rows = rows;
return (save ? this.save() : true);
}
示例7: it
it('2 ночь путана проголосует и это уже не имеет значения', (done) => {
let unsubscribe;
real_man = _.last(_.without(_.pluck(_.where(store.getState().players, {role: Roles.INHABITANT}), 'token'), mafia_target));
unsubscribe = store.subscribe(() => {
expect(store.getState().status).toBe(GameStatus.VOTE_WHORE);
expect(store.getState().active_roles).toEqual([Roles.WHORE]);
expect(store.getState().vote_variants).toEqual(_.pluck(store.getState().players.filter(player => player.token !== whore), 'token'));
expect(store.getState().votes).toEqual([{who_token: whore, for_whom_token: real_man}]);
// Отписываемся т. к. store общий для всех тестов
unsubscribe();
done();
});
store.dispatch(GameAction.vote(
whore,
real_man
));
});
示例8: build
public build(): HTMLElement {
const clear = $$(
'span',
{
className: 'coveo-facet-breadcrumb-clear'
},
SVGIcons.icons.mainClear
);
const pathToRender = without(this.categoryValueDescriptor.path, ...this.categoryFacet.options.basePath);
const captionLabel = pathToRender.map(pathPart => this.categoryFacet.getCaption(pathPart)).join('/');
const breadcrumbTitle = $$('span', { className: 'coveo-category-facet-breadcrumb-title' }, `${this.categoryFacet.options.title}:`);
const valuesContainer = $$('span', { className: 'coveo-category-facet-breadcrumb-values' }, captionLabel, clear);
new AccessibleButton()
.withElement(valuesContainer)
.withLabel(l('RemoveFilterOn', captionLabel))
.withSelectAction(this.onClickHandler)
.build();
const breadcrumb = $$('span', { className: 'coveo-category-facet-breadcrumb' }, breadcrumbTitle, valuesContainer);
return breadcrumb.el;
}