0.0.1 • Published 4 years ago

promise-in-order v0.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

promise-in-order

Execute Promise sequentially.

const { step } = require("promise-in-order");
(async () => {
  const results = await step(
    ["https://api.ipify.org/?format=json", "https://ipapi.co/json"],
    async url => (await fetch(url)).json(),
    1000
  );
  console.log({ results });
})();
import { step } from "promise-in-order";
interface Result {
  [key: string]: any;
}
(async () => {
  const results = await step<Result, string>(
    ["https://api.ipify.org/?format=json", "https://ipapi.co/json"],
    async url => (await fetch(url)).json(),
    1000
  );
  console.log({ results });
})();