repos / starfx

a micro-mvc framework for react apps
git clone https://github.com/neurosnap/starfx.git

starfx / src
Eric Bower  ·  2025-06-06

queue.ts

 1import { createQueue } from "effection";
 2
 3export function createFilterQueue<T, TClose>(predicate: (v: T) => boolean) {
 4  const queue = createQueue<T, TClose>();
 5
 6  return {
 7    ...queue,
 8    add(value: T) {
 9      if (predicate(value)) {
10        queue.add(value);
11      }
12    },
13  };
14}