Documentation / zerotal / helpers / pipe
Function: pipe()
pipe<
T,R>(value,fn):R
Defined in: packages/core/src/helpers/index.ts:176
Pass a value to a transformation function and return its result. The sibling of tap — use pipe when the value should change, tap when it shouldn't.
Type Parameters
T
T
R
R
Parameters
value
T
fn
(val) => R
Returns
R
Example
const slug = pipe(post.title, (t) => t.toLowerCase().replace(/\s+/g, '-'));