Skip to main content

Built and signed on GitHub Actions

This package works with Node.js, Deno, BrowsersIt is unknown whether this package works with Bun, Cloudflare Workers
JSR Score
88%
Published
2 months ago (0.1.0)
class Thunk

A builder for extended method chains.

Use Do to initiate the chain.

Constructors

new
Thunk(steps: readonly SyncStep[])

Type Parameters

Properties

private
readonly
_steps: readonly SyncStep[]

Methods

done(): T

Concludes the method chain and executes it.

pipe<U>(f: (value: T) => U): Thunk<U>

Pipeline operator, equivalent to |> as in Pipeline Operator Proposal.

pipeAwait<U>(f: (value: T) => Promise<U>): AsyncThunk<U>

Pipeline operator, equivalent to |> as in Pipeline Operator Proposal, combined with await.

rcall<Args extends unknown[], R, F extends (this: T, ...args: Args) => R>(f: F, ...args: Args): Thunk<R>

Call-this operator, equivalent to ~> as in Call-this Operator Proposal.

rcallAwait<Args extends unknown[], R, F extends (this: T, ...args: Args) => Promise<R>>(f: F, ...args: Args): AsyncThunk<R>

Call-this operator, equivalent to ~> as in Call-this Operator Proposal, combined with |> await %.

tap(f: (value: T) => void): Thunk<T>

The tap method as known as Object#tap in Ruby.

tapAwait(f: (value: T) => Promise<void>): AsyncThunk<T>

The tap method as known as Object#tap in Ruby, async version.

Add Package

deno add @qnighy/metaflow

Import symbol

import { Thunk } from "@qnighy/metaflow/do";

Add Package

npx jsr add @qnighy/metaflow

Import symbol

import { Thunk } from "@qnighy/metaflow/do";

Add Package

yarn dlx jsr add @qnighy/metaflow

Import symbol

import { Thunk } from "@qnighy/metaflow/do";

Add Package

pnpm dlx jsr add @qnighy/metaflow

Import symbol

import { Thunk } from "@qnighy/metaflow/do";

Add Package

bunx jsr add @qnighy/metaflow

Import symbol

import { Thunk } from "@qnighy/metaflow/do";