FluentSpec
Defined in: extract/spec.ts:249
Chainable wrapper for spec combinators. Replaces nested
mapSpec(guard(tryExtract(...))) with .map().guard().or().
Unwrapped automatically wherever a SpecLike is accepted.
Example
Section titled “Example”fluent(row.colWhere(header, cell.equals('Amount')).string()) .map(v => parseFloat(v as string), 'parseFloat') .guard(v => (v as number) > 0, 'Must be positive') .or(literal(0))Type Parameters
Section titled “Type Parameters”T extends Spec
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new FluentSpec<
T>(spec):FluentSpec<T>
Defined in: extract/spec.ts:250
Parameters
Section titled “Parameters”T
Returns
Section titled “Returns”FluentSpec<T>
Properties
Section titled “Properties”
readonlyspec:T
Defined in: extract/spec.ts:250
Methods
Section titled “Methods”guard()
Section titled “guard()”guard(
predicate,reason?):FluentSpec<GuardSpec<T>>
Defined in: extract/spec.ts:260
Parameters
Section titled “Parameters”predicate
Section titled “predicate”(v) => boolean
reason?
Section titled “reason?”string
Returns
Section titled “Returns”FluentSpec<GuardSpec<T>>
map<
Out>(fn,desc?,schemaHint?):FluentSpec<MapSpec<T,Out>>
Defined in: extract/spec.ts:252
Type Parameters
Section titled “Type Parameters”Out
Parameters
Section titled “Parameters”(v) => Out
string
schemaHint?
Section titled “schemaHint?”Record<string, unknown>
Returns
Section titled “Returns”FluentSpec<MapSpec<T, Out>>
optional()
Section titled “optional()”optional(
defaultValue?):FluentSpec<Spec>
Defined in: extract/spec.ts:277
Parameters
Section titled “Parameters”defaultValue?
Section titled “defaultValue?”unknown
Returns
Section titled “Returns”FluentSpec<Spec>
or<
U>(…fallbacks):FluentSpec<TrySpec<T|U>>
Defined in: extract/spec.ts:267
Type Parameters
Section titled “Type Parameters”U extends Spec
Parameters
Section titled “Parameters”fallbacks
Section titled “fallbacks”…(U | FluentSpec<U>)[]
Returns
Section titled “Returns”FluentSpec<TrySpec<T | U>>