本文整理汇总了TypeScript中Immutable.Set.contains方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Set.contains方法的具体用法?TypeScript Set.contains怎么用?TypeScript Set.contains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Immutable.Set
的用法示例。
在下文中一共展示了Set.contains方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: doFilter
doFilter(keys: Set<string>): boolean {
if (this._filter.size > 0) {
if (!keys) {
return this._filter.contains(NONE_FILTER_KEY);
} else {
if (this._filter.size === 1 && this._filter.contains(NONE_FILTER_KEY)) {
// All we want to match is no components, and we have some components so return that we
// should be filtered out
return false;
}
for (const key of this._filterArray) {
if (key === NONE_FILTER_KEY) {
// We have values and we are looking for some values, for this case ignore the
// none filter
continue;
}
if (keys.contains(key)) {
return true;
}
}
return false;
}
}
return true;
}
示例2: return
return objects.filter((object) => {
return (object instanceof Entity) && owners.contains(object.owner);
});
示例3:
return currentNameFragments.every(fragment => {
return previousNameFragments.contains(fragment)
|| previousNameFragments.some((prevFragment) => prevFragment.includes(fragment));
})