- Add 300+ new skills from 35+ community repositories - Total collection now at 1,200+ skills - New categories: UI/UX, Security, Data Science, Health, Quantum, Makepad - Update package.json to v7.0.0 - Update README with new stats and 20k stars celebration banner - Complete CHANGELOG with all new skills and community credits - Add release_notes.md with detailed acknowledgments Validation chain run, catalog regenerated. Thank you to our incredible community for 20,000 GitHub stars!
1.5 KiB
1.5 KiB
name, description, version, tags
| name | description | version | tags | |||||
|---|---|---|---|---|---|---|---|---|
| fp-pipe-ref | Quick reference for pipe and flow. Use when user needs to chain functions, compose operations, or build data pipelines in fp-ts. | 1.0.0 |
|
pipe & flow Quick Reference
pipe - Transform a Value
import { pipe } from 'fp-ts/function'
// pipe(startValue, fn1, fn2, fn3)
// = fn3(fn2(fn1(startValue)))
const result = pipe(
' hello world ',
s => s.trim(),
s => s.toUpperCase(),
s => s.split(' ')
)
// ['HELLO', 'WORLD']
flow - Create Reusable Pipeline
import { flow } from 'fp-ts/function'
// flow(fn1, fn2, fn3) returns a new function
const process = flow(
(s: string) => s.trim(),
s => s.toUpperCase(),
s => s.split(' ')
)
process(' hello world ') // ['HELLO', 'WORLD']
process(' foo bar ') // ['FOO', 'BAR']
When to Use
| Use | When |
|---|---|
pipe |
Transform a specific value now |
flow |
Create reusable transformation |
With fp-ts Types
import * as O from 'fp-ts/Option'
import * as A from 'fp-ts/Array'
// Option chain
pipe(
O.fromNullable(user),
O.map(u => u.email),
O.getOrElse(() => 'no email')
)
// Array chain
pipe(
users,
A.filter(u => u.active),
A.map(u => u.name)
)
Common Pattern
// Data last enables partial application
const getActiveNames = flow(
A.filter((u: User) => u.active),
A.map(u => u.name)
)
// Reuse anywhere
getActiveNames(users1)
getActiveNames(users2)