MCPcopy Create free account
hub / github.com/Effect-TS/effect / toOption

Function toOption

packages/effect/src/internal/fiberId.ts:227–245  ·  view source on GitHub ↗
(self: FiberId.FiberId)

Source from the content-addressed store, hash-verified

225
226/** @internal */
227export const toOption = (self: FiberId.FiberId): Option.Option<FiberId.FiberId> => {
228 const fiberIds = toSet(self)
229 if (HashSet.size(fiberIds) === 0) {
230 return Option.none()
231 }
232 let first = true
233 let acc: FiberId.FiberId
234 for (const fiberId of fiberIds) {
235 if (first) {
236 acc = fiberId
237 first = false
238 } else {
239 // @ts-expect-error
240 acc = pipe(acc, combine(fiberId))
241 }
242 }
243 // @ts-expect-error
244 return Option.some(acc)
245}
246
247/** @internal */
248export const toSet = (self: FiberId.FiberId): HashSet.HashSet<FiberId.Runtime> => {

Callers

nothing calls this directly

Calls 4

toSetFunction · 0.70
pipeFunction · 0.70
sizeMethod · 0.65
combineFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…