import {Readable, Subscriber} from "svelte/store" import {throttle} from "@welshman/lib" export const throttled = >(delay: number, store: S) => { if (delay) { const {subscribe} = store store = {...store, subscribe: (f: Subscriber) => subscribe(throttle(delay, f))} } return store }