MCPcopy Create free account
hub / github.com/effect-app/libs / partition_

Function partition_

packages/effect-app/src/Set.ts:296–313  ·  view source on GitHub ↗
(
  set: Set<A>,
  predicate: Predicate<A>
)

Source from the content-addressed store, hash-verified

294 predicate: Predicate<A>
295): readonly [Set<A>, Set<A>]
296export function partition_<A>(
297 set: Set<A>,
298 predicate: Predicate<A>
299): readonly [Set<A>, Set<A>] {
300 const values = set.values()
301 let e: Next<A>
302 const right = new Set<A>()
303 const left = new Set<A>()
304 while (!(e = values.next() as any).done) {
305 const value = e.value
306 if (predicate(value)) {
307 right.add(value)
308 } else {
309 left.add(value)
310 }
311 }
312 return tuple(left, right)
313}
314
315/**
316 * Test if a value is a member of a set

Callers 1

partitionFunction · 0.85

Calls 4

tupleFunction · 0.90
predicateFunction · 0.85
nextMethod · 0.65
addMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…