watchWithFilter

A watcher for readables but with filter predicate.

Demo

Store value:
0
(Check console)

Usage

<script lang="ts">
import { watchWithFilter } from "svelte-legos";
import { writable } from "svelte/store";

const counter = writable(0);
watchWithFilter(
	counter,
	(counter) => counter % 2 === 0,
	(counter) => console.log(counter)
);
</script>