Documentation / @zerotal/core / index / Fluent
Class: Fluent<T>
Defined in: helpers/fluent.ts:15
Chainable value wrapper for building readable sync transformation pipelines.
Use fluent(value) when you have a series of sync steps that would otherwise
require intermediate let variables. For async steps, use the standalone
pipeAsync / tapAsync helpers.
Example
const hash = fluent(rawEmail)
.pipe((e) => e.trim().toLowerCase())
.tap((e) => logger.info(`Registering: ${e}`))
.pipe((e) => crypto.createHash('sha256').update(e).digest('hex'))
.get();
Type Parameters
T
T
Constructors
Constructor
new Fluent<
T>(value):Fluent<T>
Defined in: helpers/fluent.ts:18
Parameters
value
T
Returns
Fluent<T>
Methods
pipe()
pipe<
R>(fn):Fluent<R>
Defined in: helpers/fluent.ts:23
Transform the wrapped value and return a new Fluent.
Type Parameters
R
R
Parameters
fn
(val) => R
Returns
Fluent<R>
tap()
tap(
fn):this
Defined in: helpers/fluent.ts:28
Run a side-effect and return the same Fluent unchanged.
Parameters
fn
(val) => void
Returns
this
get()
get():
T
Defined in: helpers/fluent.ts:34
Unwrap the final value.
Returns
T
toString()
toString():
string
Defined in: helpers/fluent.ts:39
Template-literal / string-coercion support.
Returns
string