fynjs API
    Preparing search index...

    Module xaa

    xaa

    async/await and Promise helpers.

    github: https://github.com/jchip/fynjs/tree/main/packages/xaa

    npm i xaa
    

    See the full API reference for every function, option, and type.

    API references https://jchip.github.io/xaa/

    Or just use your IDE for hint if it supports TypeScript and typedoc.

    import { timeout, delay } from "xaa";

    async function test() {
    // will throw TimeoutError
    await timeout(50, "took too long").run(delay(100));
    // will run the two functions and wait for them
    await timeout(50, "oops")
    .run([
    () => delay(10, 1),
    () => delay(15, 2),
    "some value",
    Promise.resolve("more value")
    ])
    .then(results => {
    // results === [1, 2, "some value", "more value"]
    });
    }
    import { map } from "xaa";

    async function test() {
    return await map(
    ["http://url1", "http://url2"],
    async url => fetch(url),
    { concurrency: 2 }
    );
    }

    License

    Licensed under the Apache License, Version 2.0.

    Defer
    TimeoutError
    TimeoutRunner
    MapError
    MapContext
    MapFunction
    MapOptions
    delay
    each
    filter
    isPromise
    makeDefer
    map
    mapSeries
    runTimeout
    timeout
    tryCatch
    wrap
    defer → makeDefer
    try → tryCatch