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 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.
["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() }))`."]
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 }]
```Real-time collaborative writing platform
IronCalc is a spreadsheet engine and ecosystem
ITIL-aligned IT service management platform
Customer feedback management made simple
Enterprise workflow automation and service management platform
Automate your spreadsheet tasks with AI power
Take a free 3-minute scan and get personalized AI skill recommendations.
Take free scan