本文整理汇总了TypeScript中Immutable.List.merge方法的典型用法代码示例。如果您正苦于以下问题:TypeScript List.merge方法的具体用法?TypeScript List.merge怎么用?TypeScript List.merge使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Immutable.List
的用法示例。
在下文中一共展示了List.merge方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: addNoRetweetUserIds
addNoRetweetUserIds(ids: number[]) {
const predicate = (i: Item) => {
if (i instanceof Tweet) {
return !i.isRetweet() || ids.indexOf(i.retweeted_status.user.id) === -1;
} else {
return true;
}
};
const next_home = this.home.filter(predicate).toList();
const next_mention = this.mention.filter(predicate).toList();
const next_no_retweet_ids = this.no_retweet_ids.merge(ids);
// XXX:
// Next focus index calculation is too complicated. I skipped it.
return new TimelineState(
this.kind,
next_home,
next_mention,
this.user,
this.notified,
this.rejected_ids,
next_no_retweet_ids,
this.focus_index
);
}
示例2: addRejectedIds
addRejectedIds(ids: number[]) {
const will_added = ids.filter(id => !this.rejected_ids.contains(id));
if (will_added.length === 0) {
return this;
}
const predicate = (i: Item) => {
if (i instanceof Tweet) {
const id = i.getMainStatus().user.id;
return will_added.indexOf(id) === -1;
}
return true;
};
const next_home = this.home.filter(predicate).toList();
const next_mention = this.mention.filter(predicate).toList();
const home_updated = next_home.size !== this.home.size;
const mention_updated = next_mention.size !== this.mention.size;
const next_rejected_ids = this.rejected_ids.merge(will_added);
// XXX:
// Next focus index calculation is too complicated. I skipped it.
return new TimelineState(
this.kind,
home_updated ? next_home : this.home,
mention_updated ? next_mention : this.mention,
this.user,
this.notified,
next_rejected_ids,
this.no_retweet_ids,
this.focus_index
);
}