prelude-js logoprelude-js

Getting Started

Learn how to install and use prelude-js in your project.

Install

Install the preludejs package. It has zero external runtime dependencies.

bun add preludejs
npm install preludejs
pnpm add preludejs
yarn add preludejs

Import and Use

Import the namespaces directly from preludejs or target individual modules/functions for maximum tree-shaking performance.

import { Func, List } from 'preludejs';

// Functions are curried by default
const add = Func.curry((a: number, b: number) => a + b);
const inc = add(1);

const result = List.map(inc, [1, 2, 3]); // => [2, 3, 4]

Or import subpaths directly:

import curry from 'preludejs/Func/curry.js';
import map from 'preludejs/List/map.js';

const add = curry((a: number, b: number) => a + b);
const result = map(add(1), [1, 2, 3]); // => [2, 3, 4]

On this page