Skip to content

Concepts: return model

Eugene Lazutkin edited this page Jul 1, 2026 · 2 revisions

Concepts: the return model

double-meh's central rule: the method you call fixes what comes back — options tune behavior, never the return type. You always know a call's shape from its name.

Call Returns
io.get(url) (any bare verb) the parsed data
io.full.get(url) the full response envelope
io.stream.get(url) a Web ReadableStream (GET-only)
ios.put(url, opts) a streaming {readable, writable, response} duplex
io.head(url) / io.options(url) derived metadata (no body)

Why fix the shape by method

An option that flipped the return type would force every caller to know which options were passed before they could use the result. double-meh makes the verb + namespace the single source of truth instead:

  • io.get(url) — the 99% path: const person = await io.get(url).
  • io.full.get(url) — when you need status / headers / validators. The bare verb is the envelope's .data: io.get(url)(await io.full.get(url)).data.
  • io.stream.get(url) — when you want the raw body stream.
  • ios.put/post/patch(...) — when you are streaming a request body — see Streaming.

io.full and io.stream are modifier namespaces that carry the same verbs and only change the shape; ios is a sibling callable for the request/response duplex.

Options tune behavior, not shape

ifMatch, as, cache, retry, signal, fetch, withEtag change what a call does, never what type it returns. (This is why withEtag lives on io.full.get — the type is already the envelope, so the flag only adds work — and never on bare io.get, where it would flip the type.)

See also

Clone this wiki locally