fp-pack is a practical functional programming toolkit for JavaScript and TypeScript. It provides type-safe pipelines, pipes, and currying utilities. Developers use it to build robust, maintainable code. It integrates with existing JavaScript and TypeScript workflows.
git clone https://github.com/superlucky84/fp-pack.gitfp-pack is a practical functional programming toolkit designed for JavaScript and TypeScript developers who want composition-first APIs without complex monads or wrapper ceremonies. It centers on pipe and pipeAsync for clean, left-to-right function composition, with strong TypeScript type inference that works without manual annotations. The library includes a SideEffect pattern for declarative error handling and early exits, lazy stream processing for memory-efficient operations on large datasets, and curried utilities for point-free style composition. Zero dependencies and tree-shakeable, fp-pack scales from simple scripts to larger codebases while maintaining readable, maintainable code.
["Identify the imperative code you want to refactor. Look for chains of operations (map/filter/reduce) or nested function calls.","Replace imperative chains with fp-pack's `pipe` function. Start by importing `pipe` and the necessary utilities (map, filter, etc.).","Convert side effects to pure functions using fp-pack's `IO` or `Task` types. Wrap impure operations (like API calls) in these types.","Add JSDoc comments to each step in the pipeline to document transformations. Use type annotations to ensure type safety.","Test the transformed code thoroughly. fp-pack's type safety should catch many potential errors during compilation.","Tip: Use fp-pack's currying utilities to create reusable transformation steps. For example, `map(trim('name'))` is more reusable than `map(u => ({ ...u, name: u.name.trim() }))`."]
Building type-safe data transformation pipelines with pipe composition
Handling errors and side effects declaratively with SideEffect pattern
Processing large datasets efficiently with lazy stream iterables
Creating reusable curried utility functions for composable code
No install command available. Check the GitHub repository for manual installation instructions.
git clone https://github.com/superlucky84/fp-packCopy the install command above and run it in your terminal.
Launch Claude Code, Cursor, or your preferred AI coding agent.
Use the prompt template or examples below to test the skill.
Adapt the skill to your specific use case and workflow.
Transform this JavaScript/TypeScript code snippet into a clean, functional pipeline using fp-pack utilities: [CODE_SNIPPET]. Ensure the pipeline is type-safe and uses currying where appropriate. Add JSDoc comments to document each step. If the snippet contains impure functions, wrap them in a pure interface using fp-pack's `IO` or `Task` types. Optimize for readability and maintainability.
```typescript
// Original code snippet:
const processUser = (user) => {
const processed = user
.map(u => ({ ...u, name: u.name.trim() }))
.map(u => ({ ...u, age: u.age + 1 }))
.filter(u => u.age > 18);
return processed;
};
// Transformed with fp-pack:
import { pipe, map, filter, trim, inc } from 'fp-pack';
/**
* Processes a user object by trimming the name and incrementing age.
* @param {User} user - The user object to process
* @returns {User[]} Filtered list of processed users
*/
const processUser = pipe(
/** Trim whitespace from user name */
map<{ name: string }, { name: string }>(trim('name')),
/** Increment user age by 1 */
map<{ age: number }, { age: number }>(inc('age')),
/** Filter users older than 18 */
filter<{ age: number }>(u => u.age > 18)
);
// Usage:
const users = [{ name: ' Alice ', age: 25 }, { name: 'Bob', age: 17 }];
const result = processUser(users);
// Output: [{ name: 'Alice', age: 26 }]
```IronCalc is a spreadsheet engine and ecosystem
Get more done every day with Microsoft Teams – powered by AI
Enterprise workflow automation and service management platform
Automate your spreadsheet tasks with AI power
Agentic AI Workflow platform
Connected workspace for docs, wikis, and projects
Take a free 3-minute scan and get personalized AI skill recommendations.
Take free scan