Standard Library Utilities
Set
Set stores unique values and ignores duplicates.
Set
set.ts
const extraTag: string = ;
const tags: Set<string> = new Set<string>(["typed", "web"]);
tags.add(extraTag);
tags.add("typed");
const hasRuntime: boolean = tags.has("runtime");
const summary: string = Array.from(tags).join(",");
console.log(`tags=${summary}`);
console.log(`runtime=${hasRuntime}`);
const extraTag: string = ;
const tags: Set<string> = new Set<string>(["typed", "web"]);
tags.add(extraTag);
tags.add("typed");
const hasRuntime: boolean = tags.has("runtime");
const summary: string = Array.from(tags).join(",");
console.log(`tags=${summary}`);
console.log(`runtime=${hasRuntime}`);
const extraTag: string = ;
const tags: Set<string> = new Set<string>(["typed", "web"]);
tags.add(extraTag);
tags.add("typed");
const hasRuntime: boolean = tags.has("runtime");
const summary: string = Array.from(tags).join(",");
console.log(`tags=${summary}`);
console.log(`runtime=${hasRuntime}`);
Set
A `Set<T>` keeps only one copy of each value.