@reaktivo/async-flow
TypeScript icon, indicating that this package has built-in type declarations

1.0.13 • Public • Published

async-flow

GitHub license npm version CircleCI Status Coverage PRs Welcome

async-flow is a tiny javascript function piping utility

Installation

npm install -g @reaktivo/async-flow

Usage

import asyncFlow from "@reaktivo/async-flow";

const api = asyncFlow(fetch, res => res.json(), json => json.data);

// Which is equivalent to the following
const api = function(...args) {
  return fetch(...args)
    .then(res => res.json())
    .then(json => json.data);
};

//Or
const api = async function(...args) {
  const response = await fetch(...args);
  const json = await response.json();
  return json.data;
};

License

async-flow is open source software licensed as MIT.

/@reaktivo/async-flow/

    Package Sidebar

    Install

    npm i @reaktivo/async-flow

    Weekly Downloads

    0

    Version

    1.0.13

    License

    MIT

    Unpacked Size

    5.89 kB

    Total Files

    7

    Last publish

    Collaborators

    • reaktivo