DeesseJS FP

@deessejs/fp

Functional programming utilities for TypeScript

@deessejs/fp provides lightweight functional programming primitives for TypeScript. It gives you type-safe ways to represent values that might not exist (Maybe) or operations that might fail (Result).

This library is intentionally minimal. No magic, no dependencies — just the primitives you need to write cleaner code.

What you get

PrimitivePurpose
ResultRepresents a value that may have failed (Ok | Err)
MaybeRepresents a value that may be absent (Some | None)
UnitRepresents a void return that is intentional (Unit)

Quick example

import { ok, err, some, none } from '@deessejs/fp';

// Result: operation that can fail
const divide = (a: number, b: number) =>
  b === 0 ? err('Division by zero') : ok(a / b);

// Maybe: value that may not exist
const findUser = (users: User[], id: string) =>
  users.find(u => u.id === id) ?? none;

Both types expose a consistent set of methods: map, flatMap, filter, tap, match, fold, and more.

See Also

On this page