Skip to content

API: Postprocessors

Madeline Kahn edited this page Dec 30, 2025 · 5 revisions

API"@mkacct/cdif/postprocessors"

"@mkacct/cdif/postprocessors" contains included parser postprocessors to make advanced configuration of the parser more convenient. Note that the exported functions are not postprocessor functions themselves; rather, they return postprocessor functions. (See the documentation on postprocessors for more information.)

postprocessType()

function postprocessType(
    type: string,
    fn: CDIFParserPostprocessorFunction
): CDIFParserPostprocessorFunction

Returns a postprocessor that applies the given postprocessor function (fn) if the parsed value has the given type name (type). (Otherwise it returns void, continuing to the next postprocessor as usual.)

(Note: fn's declared type is more specific than CDIFParserPostprocessorFunction to ensure TypeScript's automatic type narrowing behaves as expected, but it is more meaningfully described simply as CDIFParserPostprocessorFunction.)

Parameters:

  • type: string – the type identifier to postprocess
  • fn: CDIFParserPostprocessorFunction – the postprocessor function to apply if the type matches

Returns:

  • CDIFParserPostprocessorFunction – the postprocessor function

Clone this wiki locally