Skip to main content
zerotal

Documentation


Documentation / @zerotal/core / helpers / pipe

Function: pipe()

pipe<T, R>(value, fn): R

Defined in: 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, '-'));