本文整理汇总了TypeScript中Immutable.Set.of方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Set.of方法的具体用法?TypeScript Set.of怎么用?TypeScript Set.of使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Immutable.Set
的用法示例。
在下文中一共展示了Set.of方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('can compose Immutable::Set initial states', () => {
const state = compose(Set.of(1, 2, 3), Set.of(4, 5, 6), Set.of());
expect(Set.isSet(state)).to.be.true;
const plain = state.toJS();
expect(plain).not.to.be.null;
expect(plain).to.deep.equal([1, 2, 3, 4, 5, 6]);
});
示例2: it
it('expresses value equality with set sequences', () => {
var s1 = Set.of('A', 'B', 'C');
expect(s1.equals(null)).toBe(false);
var s2 = Set.of('C', 'B', 'A');
expect(s1 === s2).toBe(false);
expect(is(s1, s2)).toBe(true);
expect(s1.equals(s2)).toBe(true);
// Map and Set are not the same (keyed vs unkeyed)
var v1 = Map({ A: 'A', C: 'C', B: 'B' });
expect(is(s1, v1)).toBe(false);
});
示例3: it
it('always returns the same type', () => {
var a = Set.of(1,2,3);
var b = List();
expect(b.concat(a)).not.toBe(a);
expect(List.isList(b.concat(a))).toBe(true);
expect(b.concat(a)).is(List.of(1,2,3));
})
示例4: Set
export const findEntries = (context: Context) => {
const { trace } = context
let entries = Set() as Set<string>
let modulesToExplore = Set.of(...trace.keys())
while (modulesToExplore.size > 0) {
// pick a node and add it to entries
const node = modulesToExplore.first()
modulesToExplore = modulesToExplore.remove(node)
entries = entries.add(node)
const removeDepsOf = (dep) => {
modulesToExplore = modulesToExplore.remove(dep)
if (trace.has(dep))
getDependencies(context, dep)
.forEach(depToRemove => {
if (entries.has(depToRemove)) entries = entries.remove(depToRemove)
else if (modulesToExplore.has(depToRemove)) removeDepsOf(depToRemove)
})
}
removeDepsOf(node)
}
return entries.toJS()
.filter(entry => !entry.includes('jspm_packages'))
}
示例5:
const getData = () : typeof previous => {
const dataSet = Set.of(...previous.selectedItems);
if (!args.isSelect) {
return {
selectedItems: dataSet.subtract(args.items).toArray()
}
}
else {
return {
selectedItems: dataSet.union(args.items).toArray()
}
}
};
示例6: steps
public steps(): Set<this> {
return Set.of(1, -1).flatMap((z) =>
this.xy((i) => i + z),
).toSet();
}