MCPcopy Index your code
hub / github.com/Effect-TS/effect / allIn

Function allIn

packages/effect/src/List.ts:520–537  ·  view source on GitHub ↗
(
  start: List<A>,
  remaining: List<A>,
  predicate: Predicate<A>,
  isFlipped: boolean
)

Source from the content-addressed store, hash-verified

518// everything from 'start' is included, if everything from this point is in we can return the origin
519// start otherwise if we discover an element that is out we must create a new partial list.
520const allIn = <A>(
521 start: List<A>,
522 remaining: List<A>,
523 predicate: Predicate<A>,
524 isFlipped: boolean
525): List<A> => {
526 while (true) {
527 if (isNil(remaining)) {
528 return start
529 } else {
530 if (predicate(remaining.head) !== isFlipped) {
531 remaining = remaining.tail
532 } else {
533 return partialFill(start, remaining, predicate, isFlipped)
534 }
535 }
536 }
537}
538
539// we have seen elements that should be included then one that should be excluded, start building
540const partialFill = <A>(

Callers 1

noneInFunction · 0.85

Calls 3

isNilFunction · 0.85
partialFillFunction · 0.85
predicateFunction · 0.50

Tested by

no test coverage detected