@lorisleiva/postpone
TypeScript icon, indicating that this package has built-in type declarations

0.2.2 • Public • Published

Postpone 🦥

Small TypeScript library making it easier to handle complex asynchronous tasks.

Installation

npm install @lorisleiva/postpone

Usage

import { Postpone } from "@lorisleiva/postpone";

Postpone.make(async () => "Hello")
  .tap(v => console.log(v))
  .pipe(v => `${v} world`)
  .tap(v => console.log(v))
  .pipe(v => [v, v, v])
  .tap(v => console.log(v))
  .map(() => Math.round(Math.random() * 100))
  .tap(v => console.log(v))
  .run(); // <- The promise is only executed at this point.

// Console outputs:
// "Hello"
// "Hello world"
// ["Hello world", "Hello world", "Hello world"]
// [12, 94, 23]

Dependencies (0)

    Dev Dependencies (2)

    Package Sidebar

    Install

    npm i @lorisleiva/postpone

    Weekly Downloads

    1

    Version

    0.2.2

    License

    none

    Unpacked Size

    5.93 kB

    Total Files

    9

    Last publish

    Collaborators

    • lorisleiva