1.7.3 • Published 2 years ago

xaa v1.7.3

Weekly downloads
124
License
Apache-2.0
Repository
github
Last release
2 years ago

xaa

async/await and Promise helpers.

github: https://github.com/jchip/xaa

Install and Usage

npm i xaa

APIs

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

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

Examples:

xaa.timeout

import { timeout } from "xaa";

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

xaa.map

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.

1.7.3

2 years ago

1.7.2

2 years ago

1.7.1

3 years ago

1.7.0

3 years ago

1.6.2

3 years ago

1.6.1

3 years ago

1.6.0

4 years ago

1.5.0

4 years ago

1.4.0

4 years ago

1.3.1

4 years ago

1.3.0

4 years ago

1.2.2

4 years ago

1.2.0

4 years ago

1.1.5

4 years ago

1.2.1

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.2

4 years ago

1.0.1

5 years ago

1.0.0

5 years ago