Getting Started
Prerequisites
Section titled “Prerequisites”- Node.js v18 or higher
- A package manager: npm, pnpm, or yarn
Installation
Section titled “Installation”Each package is published independently under the @thuum scope. Install only the packages you need:
# npmnpm install @thuum/pipernpm install @thuum/decornpm install @thuum/promising
# pnpmpnpm add @thuum/piperQuick Examples
Section titled “Quick Examples”Pipe a value through transformations
Section titled “Pipe a value through transformations”import { pipe } from "@thuum/piper";
const { value } = pipe(1) .pipe((x) => x + 1) .pipe((x) => x * 2);
console.log(value); // 4Safe error handling
Section titled “Safe error handling”import { attempt } from "@thuum/decor";
const safeParse = attempt(JSON.parse);const result = safeParse("invalid json");
if ("error" in result) { console.error("Parse failed:", result.error);} else { console.log("Parsed:", result.value);}Sequential async execution
Section titled “Sequential async execution”import { createContext } from "@thuum/promising";
const ctx = createContext({ watch: (event) => console.log(`[${event.type}] ${event.name}`),});
ctx.run("first", async () => await fetchFirst());ctx.run("second", async () => await fetchSecond());// "second" always waits for "first" to completeDevelopment
Section titled “Development”To work on the Thuum monorepo itself:
git clone https://github.com/jalepi/thuum.gitcd thuumpnpm installpnpm run buildpnpm run test