Function
fromArray
(E: Equivalence.Equivalence<A>)
Source from the content-addressed store, hash-verified
| 505 | * Create a set from an array |
| 506 | */ |
| 507 | export function fromArray<A>(E: Equivalence.Equivalence<A>): (as: ReadonlyArray<A>) => Set<A> { |
| 508 | return (as) => { |
| 509 | const len = as.length |
| 510 | const r = new Set<A>() |
| 511 | const has = elem_(E) |
| 512 | for (let i = 0; i < len; i++) { |
| 513 | const a = as[i]! |
| 514 | if (!has(r, a)) { |
| 515 | r.add(a) |
| 516 | } |
| 517 | } |
| 518 | return r |
| 519 | } |
| 520 | } |
| 521 | |
| 522 | /** |
| 523 | * Set compaction, remove none |
Tested by
no test coverage detected
Used in the wild real call sites across dependent graphs
searching dependent graphs…