optional
Call Signature
Section titled “Call Signature”optional<
S,E>(spec,defaultValue?):FormatSpec<S,E>
Defined in: extract/spec.ts:703
Make any spec optional. Failures return the default value
(or undefined if none provided) instead of failing.
For ExtractSpec, sets the optional flag directly.
For all other spec kinds, desugars to tryExtract(spec, literal(default)).
Works universally across all formats and all failure kinds.
Type Parameters
Section titled “Type Parameters”S
E
Parameters
Section titled “Parameters”FormatSpec<S, E>
defaultValue?
Section titled “defaultValue?”unknown
Returns
Section titled “Returns”FormatSpec<S, E>
Example
Section titled “Example”optional(row.colWhere(header, cell.equals('Ownership')).number(), null)optional(someObjectSpec, null)Call Signature
Section titled “Call Signature”optional(
spec,defaultValue?):Spec
Defined in: extract/spec.ts:707
Make any spec optional. Failures return the default value
(or undefined if none provided) instead of failing.
For ExtractSpec, sets the optional flag directly.
For all other spec kinds, desugars to tryExtract(spec, literal(default)).
Works universally across all formats and all failure kinds.
Parameters
Section titled “Parameters”defaultValue?
Section titled “defaultValue?”unknown
Returns
Section titled “Returns”Example
Section titled “Example”optional(row.colWhere(header, cell.equals('Ownership')).number(), null)optional(someObjectSpec, null)