Skip to content

API Reference

The library is split into three entry points. Each is independently importable.

import from @nlozgachev/pipekit/Core

TypeDescription
OptionA value that may or may not exist. Replaces T | null | undefined.
ResultAn operation that succeeds with a value or fails with an error.
ValidationLike Result, but accumulates all errors instead of stopping at the first.
TaskA lazy async operation.
TaskResultA lazy async operation that can fail.
TaskOptionA lazy async operation that may return nothing.
TaskValidationA lazy async operation that accumulates errors.
RemoteDataThe four states of a data fetch: NotAsked, Loading, Failure, Success.
TheseAn inclusive-OR: holds an error, a value, or both simultaneously.
ArrArray utilities that return Option instead of throwing or returning undefined.
RecRecord/object utilities.

import from @nlozgachev/pipekit/Types

TypeDescription
BrandNominal typing — prevents mixing values that share the same underlying type.
NonEmptyListAn array guaranteed to have at least one element.

import from @nlozgachev/pipekit/Composition

FunctionDescription
pipePass a value through a sequence of functions, left to right.
flowCompose functions into a reusable pipeline.
composeCompose functions right to left.
tapRun a side effect without breaking the pipeline.
curryConvert a multi-argument function into a chain of single-argument functions.
memoizeCache function results by argument.
identityReturn the argument unchanged.
constantReturn a function that always returns the same value.
notNegate a predicate function.
onceCall a function at most once; return the cached result thereafter.