Prelude API
    Preparing search index...

    Module @prelude/function

    Function module

    Usage

    npm i -E @prelude/function
    
    import * as F from '@prelude/function'
    

    sleep, timeout, eventually and throttle accept { signal } (see the repository README, "Cancellation"): aborting clears the pending timer and rejects with signal.reason; eventually stops retrying and throttle drops its pending trailing call. An attempt or f already in flight is left to settle on its own.

    const controller = new AbortController()
    setTimeout(() => controller.abort(), 100)
    await F.sleep(10_000, { signal: controller.signal }) // rejects after 100 ms with signal.reason
    await F.eventually(() => fetch(url, { signal: controller.signal }).then(r => r.ok), { delay: 500, signal: controller.signal })

    License

    This package is dedicated to the public domain under CC0 1.0.

    t
    Guard
    IntersectionOfUnion
    Predicate
    Predicate2
    not
    pipe
    pipe1
    and
    dec
    equivalent
    eventually
    fire
    identity
    implies
    inc
    memoize
    mute
    noop
    or
    rescue
    serial
    sleep
    throttle
    timeout
    xor